home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-11 | 296.0 KB | 6,549 lines |
- ================================================================================
- =------------ THE BEST LIBRARY 2.32 ------------=
- =------------ THE FASTEST AND MOST EFFICIENT LIBRARY AVAILABLE ------------=
- =------------------------------------------------------------------------------=
- =---------------------- 292 PURE ASSEMBLER FUNCTIONS -----------------------=
- =---------------------- 68 C CODED ROUTINES -----------------------=
- =---------------------- -----------------------=
- =---------------------- TOTAL: 360 FUNCTIONS -----------------------=
- ================================================================================
-
- DOCUMENT LAST UPDATED 94/09/11 Sunday, September 11, 1994
- INDEPENDENTLY AUTHORED BY GEORGE VANOUS 23:31.39
-
-
- If you find this library useful, please let me know. I like hearing that my
- efforts are appreciated.
-
- You can contact me via email: vanous@helix.net
- or call me at (604)589-2675 or write to me: George Vanous
- 8930 Watson Court
- Delta, BC
- V4C 4T6
-
- NOTE This library will no longer be updated, since C is quickly being
- replaced by C++. The BESTLibrary++ 1.0 will soon be released, an
- object version of The BESTLibrary 2.32. As of today, it contains full
- support for 2D AND 3D rotation/scaling, timing classes, and text mode
- windowing classes, to mention a few. Let me know if you are interested
- in obtaining the demo .EXE of what it can currently do.
-
-
- This library covers the following categories:
-
- FILE 8 functions TEXT 33 functions
- INI FILE 9 functions ANIMATION 0 functions
- KEYBOARD 42 functions ATTRIBUTE 8 functions
- LINKED LIST 4 functions CHARACTER 16 functions
- MATH 13 functions CURSOR 23 functions
- MATRIX 18 functions GET 5 functions
- 2D VECTORS 17 functions STRING 8 functions
- 3D VECTORS 17 functions WINDOW 4 functions
- MISCELLANEOUS 9 functions VGA 3 functions
- MOUSE 13 functions VGA16 17 functions
- STRING 73 functions ANIMATION 4 functions
- CHARACTER 15 functions IMAGE 1 function
- CONVERSION 4 functions COMPRESS IMAGE 10 functions
- PIXEL IMAGE 7 functions
- PLANE IMAGE 8 functions
- VGA256 2 functions
-
- TOTAL: 360 ROUTINES
-
- --------------------------------------------------------------------------------
-
- B - changes in other functions have made this function unusable (temporary)
- X - still under development
-
- ----------------------------------------------------------------------------
- ------------------------------------ FILE --------------------------------------
-
- fil_count...........display the number of executions and some message
- fil_count_reg.......same as "counter" except this is used for registered copies
- fil_len.............return the length of a file, in bytes
- fil_next_str........return the next string from a file
- fil_next_word.......return the next word from a file
- fil_read_to.........return the contents of a file upto and including a string
- fil_read_to_strip...return the contents of a file upto and including a string
- fil_skip_past.......skip past a string in a file
- fil_skip_to.........skip to a string in a file
-
- - - - - - - - - - - - - - - - - - INI FILE - - - - - - - - - - - - - - - - - -
- ini_get_boolean.....read in a boolean parameter
- ini_get_color.......read in a color
- ini_get_number......read in a number
- ini_get_position....read in and translate a screen position into a row number
- ini_get_rows........read in the number of rows per screen
- ini_get_state.......read in the keyboard state
- ini_get_text........read in a text string
- ini_get_yesno.......read in a YES or NO response
- ini_read_section....read in the releveant text of a section
-
- ----------------------------------------------------------------------------
- --------------------------------- KEYBOARD -----------------------------------
-
- kbd_all_off.............disable all of the three LOCKS and turns off light
- kbd_all_on..............enable all of the three LOCKS and turns on light
- kbd_caps_off............disable the CAPS LOCK key and turns off the light
- kbd_caps_on.............enable the CAPS LOCK key and turns on the light
- kbd_clear...............clear the keyboard buffer of all keystrokes
- kbd_give................give control back to the original keyboard interrupt
- kbd_hit.................check keyboard buffer to see if a key has been pressed
- kbd_insert_off..........disable the INSERT mode
- kbd_insert_on...........enable the INSERT mode
- kbd_is_all_on...........report if all three LOCKS are active
- kbd_is_alt..............report if either alt is depressed
- kbd_is_alt_left.........report if the left alt is depressed
- kbd_is_alt_left_only....report if only the left alt is depressed
- kbd_is_alt_right........report if the right alt is depressed
- kbd_is_alt_right_only...report if only the right alt is depressed
- kbd_is_alt_only.........report if only an alt is depressed (not ctrl or shift)
- kbd_is_caps_on..........report if CAPS LOCK is active
- kbd_is_ctrl.............report if either ctrl is depressed
- kbd_is_ctrl_left........report if the left ctrl is depressed
- kbd_is_ctrl_left_only...report if only the left ctrl is depressed
- kbd_is_ctrl_right.......report if the left ctrl is depressed
- kbd_is_ctrl_right_only..report if only the right ctrl is depressed
- kbd_is_ctrl_only........report if only ctrl is depressed (and not alt or shift)
- kbd_is_insert_on........report if INSERT is active
- kbd_is_num_on.. ........report if NUM LOCK is active
- kbd_is_scroll_on........report if SCROLL LOCK is active
- kbd_is_shift............report if either shift is depressed
- kbd_is_shift_left.......report if the left shift is depressed
- kbd_is_shift_left_only..report if only the left shift is depressed
- kbd_is_shift_right......report if the right shift is depressed
- kbd_is_shift_right_only.report if only the right shift is depressed
- kbd_is_shift_only.......report if only shift is depressed (and not alt or ctrl)
- kbd_num_off.............disable the NUM LOCK key and turns off the light
- kbd_num_on..............enable the NUM LOCK key and turns on the light
- kbd_rate................set typematic rate and delay for repeat-key action
- kbd_scroll_off..........disable the SCROLL LOCK key and turns off the light
- kbd_scroll_on...........enable the SCROLL LOCK key and turns on the light
- kbd_status_load.........restore the previously saved keyboard status
- kbd_status_save.........save the keyboard status of insert, caps/num/scroll lock
- kbd_take................take control of the keyboard interrupt
- getchr..................get a character from the keyboard buffer
- getchre.................same as getchr, but also echoes character to the screen
-
- ----------------------------------------------------------------------------
- -------------------------------- LINKED LIST ---------------------------------
-
- lst_find............search for a node of a linked list
- lst_free_double.....deallocate each node of a doubly linked list
- lst_free_single.....deallocate each node of a singly linked list
- lst_tail............return the tail of a linked list
- lst_unlink_double...unlink a node from a doubly linked list
- lst_unlink_single...unlink a node from a singly linked list
-
- ----------------------------------------------------------------------------
- ----------------------------------- MATH -------------------------------------
-
- max_byte............return the maximum of a list of byte
- max_int.............return the maximum of a list of integers
- max_shortint........return the maximum of a list of short integers
- max_word............return the maximum of a list of words
- min_byte............return the minimum of a list of bytes
- min_int.............return the minimum of a list of integers
- min_shortint........return the minimum of a list of short integers
- min_word............return the minimum of a list of words
-
- - - - - - - - - - - - - - - - - - - MATRIX - - - - - - - - - - - - - - - - - - -
- m3_add..............add two 3x3 matrices
- m3_copy.............return a copy of a 3x3 matrix
- m3_det............X.return the determinant of a 3x3 matrix
- m3_div............X.divide two 3x3 matrices
- m3_inv............X.return the inverse of a 3x3 matrix
- m3_mul..............multiply two 3x3 matrices
- m3_new..............create and initialize a new 3x3 matrix
- m3_sub..............subtract two 3x3 matrices
- m3_transpose........transpose a 3x3 matrix
- m4_add..............add two 4x4 matrices
- m4_copy.............return a copy of a 4x4 matrix
- m4_det............X.return the determinant of a 4x4 matrix
- m4_div............X.divide two 4x4 matrices
- m4_inv............X.return the inverse of a 4x4 matrix
- m4_mul..............multiply two 4x4 matrices
- m4_new..............create and initialize a new 4x4 matrix
- m4_sub..............subtract two 4x4 matrices
- m4_transpose........transpose a 4x4 matrix
-
- - - - - - - - - - - - - - - - - - 2D VECTORS - - - - - - - - - - - - - - - - - -
- v2_add..............add two 2D vector
- v2_combine..........return the linear combination of two 2D vectors
- v2_copy.............return a copy of a 2D vector
- v2_dot..............return the dot product of two 2D vectors
- v2_len..............return the magnitude (length) of 2D vector
- v2_len_sqr..........return the magnitude (length) of 2D vector squared
- v2_lerp.............linearly interpolate between two 2D vectors by some amount
- v2_mul..............multiply two 2D vectors component-wise
- v2_mul_by_matrix..X.multiply a 2D point by a matrix
- v2_mul_by_proj......multiply a 2D point by a projection matrix
- v2_neg..............negate a 2D vector
- v2_new..............create and initialize a new 2D vector
- v2_norm.............normalize a 2D vector (becomes unit length)
- v2_ortho............return some orthogonal 2D vector to a 2D vector
- v2_scale............scale a 2D vector to some new length
- v2_seg_len..........return distance (line segment length) between two 2D points
- v2_sub..............subtract two 2D vectors
-
- - - - - - - - - - - - - - - - - - 3D VECTORS - - - - - - - - - - - - - - - - - -
- v3_add..............add two 3D vector
- v3_combine..........return the linear combination of two 3D vectors
- v3_copy.............return a copy of a 3D vector
- v3_cross............return the cross product of two 3D vectors
- v3_dot..............return the dot product of two 3D vectors
- v3_len..............return the magnitude (length) of 3D vector
- v3_len_sqr..........return the magnitude (length) of 3D vector squared
- v3_lerp.............linearly interpolate between two 3D vectors by some amount
- v3_mul..............multiply two 3D vectors component-wise
- v3_mul_by_matrix....multiply a 3D point by a matrix
- v3_mul_by_proj......multiply a 3D point by a projection matrix
- v3_neg..............negate a 3D vector
- v3_new..............create and initialize a new 3D vector
- v3_norm.............normalize a 3D vector (becomes unit length)
- v3_ortho..........X.return some orthogonal 3D vector to a 3D vector
- v3_scale............scale a 3D vector to some new length
- v3_seg_len..........return distance (line segment length) between two 3D points
- v3_sub..............subtract two 3D vectors
-
- ----------------------------------------------------------------------------
- ------------------------------- MISCELLANEOUS --------------------------------
-
- beep................beeps the speaker
- bestlib_init........initialize THE BEST LIBRARY and set default values
- boot................either warm of cold boot the system
- dos_shell...........shells to DOS, returning upon the user typing "EXIT"
- msec................delays the computer for a specific number of milliseconds
- sound_off...........stops any sound coming from the speaker
- stopw...............set a delay stopwatch to a specific clock-tick delay
- video_get...........read the current video mode
- video_set...........change the video mode
-
- ----------------------------------------------------------------------------
- ----------------------------------- MOUSE ------------------------------------
-
- ms_get..............store the location of the mouse cursor
- ms_getx.............return the mouse cursor abscissa
- ms_gety.............return the mouse cursor ordinate
- ms_hide.............hides the mouse cursor
- ms_init.............initialize the mouse and set "mousedata" values to default
- ms_kill.............completely disable the mouse driver
- ms_range............set the mouse cursor's minimum and maximum range of movement
- ms_set..............set the mouse cursor's abscissa and ordinate
- ms_setx.............set the mouse cursor's abscissa
- ms_sety.............set the mouse cursor's ordinate
- ms_shape............change the mouse character in text mode
- ms_show.............display the mouse cursor
- ms_stat.............store detailed information about the mouse's status
-
- ----------------------------------------------------------------------------
- ---------------------------------- STRING ------------------------------------
-
- case_down...........return an UPPERCASE letter as lowercase
- case_down_ptr.......convert an UPPERCASE letter to lowercase
- case_flip...........return the opposite case of a letter
- case_flip_ptr.......convert a letter to the opposite case
- case_up.............return a lowercase letter as UPPERCASE
- case_up_ptr.........convert a lowercase letter to UPPERCASE
- is_number_dec.......check if a string is a decimal number
- is_number_hex.......check if a string is a hexadecimal number
- mem_copy............makes a copy of a memory location
- scan_byte...........search for a one-byte value
- scan_byte_not.......search for any other one-byte value
- scan_bytes..........search for one of several one-byte values
- scan_bytes_not......search for any other one-byte values
- scan_str............search for a string of characters
- scan_str_not......X.search for any other string of characters
- scan_strs.........X.search for one of several strings of characters
- scan_strs_not.....X.search for any other string of characters
- scan_word...........search for a one-word (two-byte) value
- scan_word_not.......search for any other one-word (two-byte) value
- scan_words..........search for one of several one-word (two-byte) values
- scan_words_not......search for any other one-word (two-byte) value
- sign................return the sign of a number
- str_add...........X.adds to a number stored as an ASCII string
- str_case_down.......convert all characters in a string to lowercase
- str_case_down_pr....convert all characters in "prdata.string" to lowercase
- str_case_flip.......convert all characters in a string to the opposite case
- str_case_flip_pr....convert all characters in "prdata.string" to opposite case
- str_case_up.........convert all characters in a string to uppercase
- str_case_up_pr......convert all characters in "prdata.string" to uppercase
- str_cmp.............compares two strings for equality
- str_copy............copies a string
- str_dec.............decrements a number stored as an ASCII string
- str_del_byte........delete all occurrences of a byte from a string
- str_del_bytes.......delete bytes from a string
- str_del_str.......X.delete all occurences of a string from a string
- str_del_word........delete all occurrences of a word from a word-value array
- str_del_words.......delete word from an array of word-values
- str_div...........X.divides a number stored as an ASCII string
- str_fill_byte.......fill memory with a one-byte value
- str_fill_str........fill memory with a string of characters
- str_fill_word.......fill memory with a one-word (two-byte) value
- str_inc.............increments a number stored as an ASCII string
- str_ins_byte........insert a one-byte value into a string
- str_ins_str.........insert a string of characters into a string
- str_ins_word........insert a one-word (two-byte) value into an array of words
- str_len.............return the length of a string
- str_len_pr..........return the length of "prdata.string"
- str_mul...........X.multiplies a number stored as an ASCII string
- str_next_str........return the next string from a string
- str_next_word.......return the next word from a string
- str_rep_byte_byte...search for a byte and replaces it with a different byte
- str_rep_byte_word...search for a byte and replaces it with a word
- str_rep_byte_str....search for a byte and replaces it with a string
- str_rep_str_byte....search for a string and replaces it with a byte
- str_rep_str_str.....search for a string and replaces it with another string
- str_rep_word_byte...search for a word and replaces it with a byte
- str_rep_word_word...search for a word and replaces it with a different word
- str_right...........read one string character, counting from the right
- str_right_pr........read one "prdata.string" character, counting from the right
- str_sub...........X.subtracts from a number stored as an ASCII string
-
- - - - - - - - - - - - - - - - - - CHARACTER - - - - - - - - - - - - - - - - - -
- is_alpha............check if a character is an alphabet letter
- is_alpha_down.......check if a character is a lowercase alphabet letter
- is_alpha_up.........check if a character is an uppercase alphabet letter
- is_alphanum.........check if a character is an alphanumeric character
- is_ascii............check if a character is a standard ASCII character
- is_case_down........check if a character is a lowercase letter
- is_case_up..........check if a character is an uppercase letter
- is_ctrlchar.........check if a character is a control character (0-31 or 127)
- is_digit_dec........check if a character is a decimal digit
- is_digit_hex........check if a character is a hexadecimal digit
- is_letter...........check if a character is an alphabet letter, ', or -
- is_letternum........check if a character is an alphanumeric letter, ', or -
- is_greek............check if a character is a greek letter
- is_print............check if a character is a printable character (ASCII symbol)
- is_punc.............check if a character is a punctuation character
-
- - - - - - - - - - - - - - - - - - CONVERSION - - - - - - - - - - - - - - - - - -
- con_bool_to_str.....convert a numerical boolean value into its string equivalent
- con_color_to_str....convert a numerical color value into its string equivalent
- con_str_to_bool.....convert a boolean word into its numerical equivalent
- con_str_to_color....convert a color name into its numerical equivalent
-
- ----------------------------------------------------------------------------
- ----------------------------------- TEXT -------------------------------------
-
- txt_ascii_get..,,.X.read in ASCII character patterns
- txt_ascii_set.......redefine ASCII character patterns to allow for new characters
- txt_blink...........set 16 background colors or blinking characters
- txt_char_height.....return the height of text mode characters (in pixels)
- txt_char_length.....return the length of text mode characters (in pixels)
- txt_cls.............clear the screen
- txt_erase...........overwrite a region of characters with spaces
- txt_erase_col.......overwrite one column of characters with spaces
- txt_erase_row.......overwrite one row of characters with spaces
- txt_fill_area.......fill a screen region according to the structure "fidata"
- txt_fill_col........fill a screen column with a string in a defined color
- txt_fill_row........fill a screen row with a string in a defined color
- txt_flood...........flood the screen with a character in a fg/bg color
- txt_get_abs.........return the absolute address of the text page
- txt_get_act.........return the active text page
- txt_get_vis.........return the visual text page
- txt_last............return the last text page
- txt_mem.............store or restore the text screen
- txt_print...........print to the text screen according to the structure "prdata"
- txt_rows............return the [number of rows per page]-1
- txt_scroll..........smoothly scrolls, in any direction, the entire screen
- txt_scroll_fast.....quickly smoothly scrolls (may be some flicker) the screen
- txt_scroll_off....X.smoothly scrolls the screen off in a direction
- txt_scroll_on.....X.smoothly scrolls a screen on in a direction
- txt_scroll_over.....smoothly scrolls a screen overtop another screen
- txt_scroll_rows.....smoothly scrolls certain rows
- txt_scroll_window.X.smoothly scrolls, in any direction, a window of the screen
- txt_set_abs.........set the absolute offset of the text page
- txt_set_act.........set the active text page
- txt_set_rel.........set the relative offset of the text page
- txt_set_vis.........set the visual text page
- txt_split...........split the visual screen into two mirror images
-
- - - - - - - - - - - - - - - - - - ANIMATION - - - - - - - - - - - - - - - - - -
- NONE YET :(
-
- - - - - - - - - - - - - - - - - - ATTRIBUTE - - - - - - - - - - - - - - - - - -
- txt_attr_save.......save one attribute
- txt_attr_show.......print a specific number of one attribute
- txt_attrs_fill......fill a screen region with a foreground and background color
- txt_attrs_need......return memory requirement for a "txt_attrs_save"ed image
- txt_attrs_save......read a region of attributes
- txt_attrs_show......print a region of attributes
- txt_attrs_show_char...X.print only one attribute from a region of attributes
- txt_attrs_show_str....X.print only one string of attributes from a region
- txt_attrs_show_region.X.print only one region from a region of attributes
- txt_bg_get..........save the background color at specified coordinates
- txt_fg_get..........save the foreground color at specified coordinates
-
- - - - - - - - - - - - - - - - - - CHARACTER - - - - - - - - - - - - - - - - - -
- txt_chr_attr_save...save a character and its attribute
- txt_chr_attr_show...print a specific number of one character in a defined color
- txt_chr_erase.......overwrite a specific number of characters with spaces
- txt_chr_get.........read one character
- txt_chr_show........print a specific number of one character
- txt_chrattr_save....read a character with its attribute
- txt_chrattr_show....print a specific number of characters with attributes
- txt_chrattrs_fill...fill a screen region with a fg/bg color and a character
- txt_chrattrs_need...return memory requirement for "txt_chrattrs_save"ed image
- txt_chrattrs_save...read a region of characters with their attributes
- txt_chrattrs_show...print a region of characters with their attributes
- txt_chrattrs_show_char.....print only one character from a region
- txt_chrattrs_show_str......print only a string of characters from a region
- txt_chrattrs_show_region.X.print only a region from a region
- txt_chrs_erase......overwrite a "textimagedata"ed image with spaces
- txt_chrs_fill.......fill a screen with with a character
- txt_chrs_need.......return the memory requirement for a "txt_chrs_save"ed image
- txt_chrs_save.......read a region of characters
- txt_chrs_show.......print a region of characters
- txt_chrs_show_char...X.print only one character from a region of characters
- txt_chrs_show_str....X.print only one string of characters from a region
- txt_chrs_show_region.X.print only one region from a region of characters
-
- - - - - - - - - - - - - - - - - - - CURSOR - - - - - - - - - - - - - - - - - - -
- cur_get_coord.......store the cursor location
- cur_get_coord_abs...store the cursor location as reported by the VGA card
- cur_get.............store all cursor information
- cur_get_abs.........store all cursor information as reported by the VGA card
- cur_get_x...........return the cursor abscissa
- cur_get_x_abs.......return the cursor abscissa as reported by the VGA card
- cur_get_y...........return the cursor ordinate
- cur_get_y_abs.......return the cursor ordinate as reported by the VGA card
- cur_is_on...........check if the cursor is on
- cur_off.............turns cursor off
- cur_on..............turns cursor on
- cur_set.............set all the cursor's statistics
- cur_set_bios........set all the cursor's statistics via BIOS
- cur_set_coord.......set the cursor's abscissa and ordinate
- cur_set_coord_bios..set the cursor's abscissa and ordinate via BIOS
- cur_get_shape.......store the cursor's shape on the active page
- cur_get_shape_abs...store the cursor's shape as reported by the VGA card
- cur_set_shape.......define a new cursor shape on the active page
- cur_set_shape_bios..define a new cursor shape on the active page via BIOS
- cur_set_x...........set the cursor's abscissa
- cur_set_x_bios......set the cursor's abscissa via BIOS
- cur_set_y...........set the cursor'r ordinate
- cur_set_y_bios......set the cursor's ordinate via BIOS
-
- - - - - - - - - - - - - - - - - - - - GET - - - - - - - - - - - - - - - - - - -
- txt_get_let.........prompts the user for input -- accepts only alphabet letters
- txt_get_num.........prompts the user for input -- accepts only digits and signs
- txt_get_numu........prompts the user for unsigned input -- accepts only digits
- txt_get_numl......X.prompts user for long input -- accepts only digits and signs
- txt_get_numlu.....X.prompts user for unsigned long input -- accepts only digits
- txt_get_str.........prompts the user for input -- accepts all ASCII characters
-
- - - - - - - - - - - - - - - - - - - STRING - - - - - - - - - - - - - - - - - - -
- txt_str_attr_show...print a string with attributes
- txt_str_erase.......overwrite a string with spaces
- txt_str_erase_pr....overwrite "prdata.string" with spaces
- txt_str_save........read a string from the text screen
- txt_str_show........print a string
- txt_strattr_need....return memory requirement for a "txt_strattr_save"ed image
- txt_strattr_save....read a string with its attributes from the text screen
- txt_strattr_show....print a "txt_strattr_save"ed string with its attributes
-
- - - - - - - - - - - - - - - - - - - WINDOW - - - - - - - - - - - - - - - - - - -
- win_define..........define a new window
- win_move............move a window to absolute coordinates
- win_move_rel........move a window relative to its current position
- win_scroll..........scrolls a window
-
- ----------------------------------------------------------------------------
- ------------------------------------ VGA -------------------------------------
-
- fade_in.............fade into a screen
- fade_out............fade a screen out to black
- isit_color..........check if current display adapter is color capable
- isit_ega............check if current display adapter is EGA capable
- isit_vga............check if current display adapter is VGA capable
- isit_svga.........X.check if current display adapter is SuperVGA capable
-
- ----------------------------------------------------------------------------
- ----------------------------------- VGA16 ------------------------------------
-
- _16_boxfill.........draw a solid box
- _16_boxfillxy.....X.draw a solid box
- _16_boxoutline......draw a box outline
- _16_boxoutlinexy..X.draw a box outline
- _16_floodall........flood the screen all one color
- _16_floodallall.....flood a 640x816 region of video memory all one color
- _16_linebiglen....X.draw a line using a specific block size
- _16_linebigxy.......draw a line using a specific block size
- _16_linelen.........draw a line
- _16_linexy..........draw a line
- _16_pixel...........change the color of a pixel
- _16_pixel_avg.......return the average color of nine pixels surrounding a point
- _16_pixel_color.....read the color of a pixel
- _16_pixel_is........check if a specific pixel is a specific color
- _16_popupcolumn.....same as "popupmenu" except only one column is used
- _16_popupmenu.......creates a menu system in graphics mode
- _16_scrollevel......read the number of rows currently scrolled
- _16_scrollrow.......scrolls a specific number of rows
- _16_thermal.........generate a thermal equilibrium style spread
-
- - - - - - - - - - - - - - - - - - ANIMATION - - - - - - - - - - - - - - - - - -
- _16_animat_rect...B.animate any solid rectangular "_16_i_save"ed image
- _16_i_move........B.move any "_16_i_save"ed image
- _16_move..........X.move using true 32-bit data transfers
- _16_p_move........B.move any "_16_p_save"ed image
-
- - - - - - - - - - - - - - - - - - - IMAGE - - - - - - - - - - - - - - - - - - -
- _16_copy............copy any "_16_c_save"ed/"_16_i_save"ed/"_16_p_save"ed image
-
- - - - - - - - - - - - - - - - - COMPRESS IMAGE - - - - - - - - - - - - - - - - -
- _16_c_move........B.move any "_16_c_save"ed image
- _16_c_need_scrn.....memory need for any screen image that is to be "_16_c_save"ed
- _16_c_need_wrst.....worst-case compression for a theoretical "_16_c_save"ed image
- _16_c_percent.......calculate how much percent smaller a "_16_c_save"ed image is
- _16_c_read_off....X.read a pixel color of any "_16_c_save"ed image by offset
- _16_c_read_xy.....X.read a pixel color of any "_16_c_save"ed image by (x,y)
- _16_c_save..........store an image into memory from the screen using compression
- _16_c_show..........write any "_16_c_save"ed image to the screen
- _16_i_to_c........X.convert any "_16_i_save"ed image to a "_16_c_save"ed image
- _16_p_to_c........X.convert any "_16_p_save"ed image to a "_16_c_save"ed image
-
- - - - - - - - - - - - - - - - - - PIXEL IMAGE - - - - - - - - - - - - - - - - -
- _16_c_to_p........X.convert any "_16_c_save"ed image to a "_16_p_save"ed image
- _16_i_to_p........X.convert any "_16_i_save"ed image to a "_16_p_save"ed image
- _16_p_need..........calculate the memory requirement of any "_16_p_save"ed image
- _16_p_save..........store an image from the screen on a pixel by pixel algorithm
- _16_p_read_off......read a pixel color of any "_16_p_save"ed image by offset
- _16_p_read_xy.......read a pixel color of any "_16_c_save"ed image by (x,y)
- _16_p_show..........write any "_16_p_save"ed image to the screen
-
- - - - - - - - - - - - - - - - - - PLANE IMAGE - - - - - - - - - - - - - - - - -
- _16_c_to_i........X.convert any "_16_c_save"ed image to a "_16_i_save"ed image
- _16_i_need..........calculate the memory requirement of any "_16_i_save"ed image
- _16_i_read_off......read a pixel color of any "_16_i_save"ed image by offset
- _16_i_read_xy.......read a pixel color of any "_16_c_save"ed image by (x,y)
- _16_i_save..........store an image from the screen on a plane by plane algorithm
- _16_i_show..........write any "_16_i_save"ed image to the screen
- _16_p_to_i..... ..X.convert any "_16_p_save"ed image to a "_16_i_save"ed image
- _16_restore_bg......restore from RAM a region of the screen background
-
- ----------------------------------------------------------------------------
- ------------------------------------ VGA256 ------------------------------------
-
- _256_floodall.......flood the screen all one color
- _256_pixel..........change the color of a pixel
-
- --------------------------------------------------------------------------------
-
-
- ================================================================================
- ==================== BEGINNING OF LIBRARY DOCUMENTATION ======================
- ================================================================================
-
- !!! IMPORTANT NOTES !!!
-
- *** NOTE all functions in THE BEST LIBRARY require FAR calls -- if you are
- using a C compiler, set it to the Large Memory Model
-
- *** NOTE these variables need to be declared globally:
- asciiscan keyp; /* global structure "keyp" */
- cursordata cursor; /* global structure "cursor" */
- mousedata msdata; /* global structure "msdata" */
-
- *** NOTE a VGA display is assumed by all functions
-
- *** NOTE abscissa refers to x-coordinate and ordinate refers to y-coordinate
-
- *** NOTE if the speaker beeps unexpectedly, something illegal was attempted
- (ie. if "str_show" is not passed a NULL-terminated string)
-
- *** NOTE when allocating memory for strings, always remember to allocate
- [the length of the largest string] + 1 bytes
- (ex. for an 8 character maximum input into string "str":
- str = (char *) malloc(9); /* [maximum length of input] + 1 */
- txt_get_let(TCUR, TCUR, str, 8, '_', "What is your name? ", WHITE, BLUE, "Ted");
- will print What is your name? Ted_____ at the current text cursor
- coordinates (TCUR, TCUR) and position the cursor under the T in Ted
- (Ted is the default name); a maximum of eight characters will be
- accepted
-
- *** NOTE all video output functions check the global variable "mousepresent"
- defined by mouse unit; if it is FALSE, the mouse cursor is ignored
- and if it is TRUE, the mouse cursor is hidden before performing any
- video output and shown again after the function finishes
-
- *** NOTE all video output (text and graphics modes) is performed with direct
- screen writes (the BIOS is not used) unless otherwise stated
-
- *** NOTE all coordinates are (0,0) - (MAXX-1, MAXY-1)
- - the text screen is usually 80x25, so the coordinates would be
- (0,0) - (79,24)
- - the VGA graphic screen is usually 640x480, so the coordinates
- would be (0,0) - (639,479)
-
- *** NOTE each text page has its own cursor position and cursor shape
-
- *** NOTE the cursor position is not modified by a function unless stated in
- the description of that function
-
- *** NOTE all functions that use the cursor use the cursor on the active text
- page and not the visual text page (make the active text page the
- same as the visual text page to operate on the visual text page)
-
- *** NOTE those parameters that ask for an "x" and a "y" will accept TCUR or
- MCUR, as described:
- - if "x" = TCUR, the text cursor abscissa is used
- = MCUR, the mouse cursor abscissa is used
- - if "y" = TCUR, the text cursor ordinate is used
- = MCUR, the mouse cursor ordinate is used
- in addition, some functions also accept MEM, which is explicity
- stated in the function's description
-
- *** NOTE those parameters that ask for a "length" and a "height" will accept
- negative numbers (to mean opposite direction)
- - positive "length" is to the right whereas negative is to the left
- - positive "height" is downward whereas negative is upward
- - ex: /* both draw the same box */
- boxfill(10, 10, 5, 5, YELLOW, COPY_IMAGE);
- boxfill(14, 14, -5, -5, YELLOW, COPY_IMAGE);
-
- *** NOTE all graphic images have a maximum size of exactly 65517 bytes
-
- *** NOTE all strings have a maximum length of 65531 characters
-
- *** NOTE some functions directly correspond to those offered by your compiler;
- the functions provided in THE BEST LIBRARY are more efficient and
- should be used over the compiler's functions
-
- *** NOTE the few functions that are still under development may be completed
- by the time you are reading this text; call me, George Vanous, at
- the phone number listed at the end of this document to verify the
- status of these functions
-
- *** NOTE if you have any questions or comments, feel free to contact me by
- phone or mail
-
- *** NOTE see !BESTLIB.H for a more brief description of every function
-
- ==========================--------------------------============================
- ---------------------------- GLOBAL DEFINITIONS ------------------------------
- --------------------------
- /* COLOR DEFINITIONS */
-
- BLACK.................... 0x0 0
- BLUE..................... 0x1 1
- GREEN.................... 0x2 2
- CYAN..................... 0x3 3
- RED...................... 0x4 4
- MAGENTA.................. 0x5 5
- BROWN.................... 0x6 6
- LIGHTGREY................ 0x7 7
- DARKGREY................. 0x8 8
- LIGHTBLUE................ 0x9 9
- LIGHTGREEN............... 0xA 10
- LIGHTCYAN................ 0xB 11
- LIGHTRED................. 0xC 12
- LIGHTMAGENTA............. 0xD 13
- YELLOW................... 0xE 14
- WHITE.................... 0xF 15
- BLINKCHAR................ 0x8 value to add to background color for blinking
-
- --------------------------------------------------------------------------------
-
- /* NUMBER DEFINITIONS */
-
- ZERO.................... 0x00 0
- ONE..................... 0x01 1
- TWO..................... 0x02 2
- THREE................... 0x03 3
- FOUR.................... 0x04 4
- FIVE.................... 0x05 5
- SIX..................... 0x06 6
- SEVEN................... 0x07 7
- EIGHT................... 0x08 8
- NINE.................... 0x09 9
- TEN..................... 0x0A 10
- ELEVEN.................. 0x0B 11
- TWELVE.................. 0x0C 12
- THIRTEEN................ 0x0D 13
- FOURTEEN................ 0x0E 14
- FIFTEEN................. 0x0F 15
- SIXTEEN................. 0x10 16
- SEVENTEEN............... 0x11 17
- EIGHTEEN................ 0x12 18
- NINETEEN................ 0x13 19
- TWENTY.................. 0x14 20
-
- PI...................... 3.141593 the venerable pi
- PIx2.................... 6.283185 2 * pi
- PIx4.................... 12.56637 4 * pi
- PIby2................... 1.570796 pi / 2 (180 degrees)
- PIby3................... 1.047197 pi / 3 ( 60 degrees)
- PIby4................... 0.785398 pi / 4 ( 45 degrees)
- PIby6................... 0.523599 pi / 6 ( 30 degrees)
- E....................... 2.718282 the venerable e
- SQRT2................... 1.414214 sqrt(2)
- SQRT3................... 1.732051 sqrt(3)
- GOLDEN.................. 1.618034 the golden ratio
- DtoR.................... 0.017453 convert degrees to radians
- RtoD.................... 57.29578 convert radians to degrees
-
-
- --------------------------------------------------------------------------------
-
- /* GENERAL-PURPOSE DEFINITIONS */
-
- CR....................... '\r' carriage return character
- LF....................... '\n' linefeed character
- NO........................ -1 logical constant
- YES....................... +1 logical constant
- NONE...................... 0 logical constant
- OFF....................... 0 logical constant
- ON........................ +1 logical constant
- BOTH...................... +2 logical constant
- UNMODIFY.................. +2 logical constant
- FALSE...................... 0 logical constant
- TRUE.................!(FALSE) logical constant
- BACKWARD.................. -1 logical constant
- FORWARD................... +1 logical constant
- WARM.................. 0x1234 warm boot identifier (like pressing ctrl-alt-del)
- COLD....................... 0 cold boot identifier (like pressing reset button)
- MAX....................... -1 logical constant
- MIN....................... -2 logical constant
- MAXX..................... 640 total screen x-length
- MAXXHALF................. 320 half screen x-length
- MAXMAXX.................. 640 total (screen)+(virtual screen) x-length
- MAXMAXXHALF.............. 320 half (screen)+(virtual screen) x-length
- MAXY..................... 480 total screen y-height
- MAXYHALF................. 240 half screen y-height
- MAXMAXY.................. 816 total (screen)+(virtual screen) y-height
- MAXMAXYHALF.............. 408 half (screen)+(virtual screen) y-height
- WATCH_MAX................ 100 maximum number of stopwatches
- SIGNED.................... -1 signed number
- UNSIGNED................... 1 unsigned number
- TCUR...................... -1 text cursor
- MCUR...................... -2 mouse cursor
- MEM....................... -3 memory cursor (coordinates stored in memory)
- TEXTSAVE................... 0 store text video memory
- TEXTSHOW................... 1 restore text video memory
- TEXT....................... 1 text mode
- TEXT25..................... 3 25-line text mode
- TEXT50..................... 2 50-line text mode
- TEXT25F................... -1 forced 25-line text mode
- TEXT50F................... -2 forced 50-line text mode
- VGA16..................... 18 640x480x16 graphics mode
- VGA256.................... 19 320x200x256 graphics mode
- TEXTPAGE1.................. 0 text video page 1
- TEXTPAGE2.................. 1 text video page 2
- TEXTPAGE3.................. 2 text video page 3
- TEXTPAGE4.................. 3 text video page 4
- TEXTPAGE5.................. 4 text video page 5
- TEXTPAGE6.................. 5 text video page 6
- TEXTPAGE7.................. 6 text video page 7
- TEXTPAGE8.................. 7 text video page 8
- TEXTPAGELAST.............. 16 last video page: 4 for 50 lines, 8 for 25 lines
- TEXTPAGEACTIVE............ -1 current active text video page
- TEXTPAGEVISUAL............ -2 current visual text video page
- TEXTIMAGE_OVERHEAD........ 8 overhead, in bytes, of "textimagedata"ed objects
- TOP....................... 1 top (same as up)
- UP........................ 1 upward direction
- LEFT...................... 2 leftward direction
- RIGHT..................... 4 rightward direction
- DOWN...................... 8 downward direction
- BOTTOM.................... 8 bottom (same as down)
- ALIGN_NONE................ -1 perform no alignment when outputting text
- ALIGN_HORZ................. 0 horizontal center, shifting odd length left
- ALIGN_VERT................. 1 vertical center, shifting odd length up
- ALIGN_CENTER............... 2 horizontal and vertical center
- ALIGN_RIGHT................ 3 right justify the text
- COPY_IMAGE............ 0x0003 hexadecimal code for performing a direct copy
- AND_IMAGE............. 0x0803 hexadecimal code for performing a logical AND
- OR_IMAGE.............. 0x1003 hexadecimal code for performing a locical OR
- XOR_IMAGE............. 0x1803 hexadecimal code for performing an eXclusive OR
- COPY_IMAGE_SET........ 0x0013 perform a direct copy and set to scroll
- AND_IMAGE_SET......... 0x0813 perform a logical AND and set to scroll
- OR_IMAGE_SET.......... 0x1013 perform a locical OR and set to scroll
- XOR_IMAGE_SET......... 0x1813 perform an eXclusive OR and set to scroll
-
- --------------------------------------------------------------------------------
-
- /* ASCII CODE CONSTANTS */
-
- BACKSPACE.................. 0x08 ... backspace keypress
- SPACE...................... 0x20 ... 32
- QUOTE...................... 0x22 ... 34
- APOSTROPHE................. 0x27 ... 39
- HYPHEN..................... 0x2D ... 45
- BLOCK_SOLID................ 0xDB ... 219
-
- --------------------------------------------------------------------------------
-
- /* SCAN CODE CONSTANTS */
-
- SCAN_NONE.................. 0x00 ... 0
- SCAN_ESC................... 0x01 ... 1
- SCAN_1..................... 0x02 ... 2
- SCAN_2..................... 0x03 ... 3
- SCAN_3..................... 0x04 ... 4
- SCAN_4..................... 0x05 ... 5
- SCAN_5..................... 0x06 ... 6
- SCAN_6..................... 0x07 ... 7
- SCAN_7..................... 0x08 ... 8
- SCAN_8..................... 0x09 ... 9
- SCAN_9..................... 0x0A ... 10
- SCAN_0..................... 0x0B ... 11
- SCAN_HYPHEN................ 0x0C ... 12
- SCAN_EQUAL................. 0x0D ... 13
- SCAN_BACKSPACE............. 0x0E ... 14
- SCAN_TAB................... 0x0F ... 15
- SCAN_Q..................... 0x10 ... 16
- SCAN_W..................... 0x11 ... 17
- SCAN_E..................... 0x12 ... 18
- SCAN_R..................... 0x13 ... 19
- SCAN_T..................... 0x14 ... 20
- SCAN_Y..................... 0x15 ... 21
- SCAN_U..................... 0x16 ... 22
- SCAN_I..................... 0x17 ... 23
- SCAN_O..................... 0x18 ... 24
- SCAN_P..................... 0x19 ... 25
- SCAN_BRACKET_LEFT.......... 0x1A ... 26
- SCAN_BRACKET_RIGHT......... 0x1B ... 27
- SCAN_ENTER................. 0x1C ... 28
- SCAN_CTRL.................. 0x1D ... 29
- SCAN_A..................... 0x1E ... 30
- SCAN_S..................... 0x1F ... 31
- SCAN_D..................... 0x20 ... 32
- SCAN_F..................... 0x21 ... 33
- SCAN_G..................... 0x22 ... 34
- SCAN_H..................... 0x23 ... 35
- SCAN_J..................... 0x24 ... 36
- SCAN_K..................... 0x25 ... 37
- SCAN_L..................... 0x26 ... 38
- SCAN_SEMICOLON............. 0x27 ... 39
- SCAN_QUOTE................. 0x28 ... 40
- SCAN_BACKQUOTE............. 0x29 ... 41
- SCAN_SHIFT_LEFT............ 0x2A ... 42
- SCAN_BACKSLASH............. 0x2B ... 43
- SCAN_Z..................... 0x2C ... 44
- SCAN_X..................... 0x2D ... 45
- SCAN_C..................... 0x2E ... 46
- SCAN_V..................... 0x2F ... 47
- SCAN_B..................... 0x30 ... 48
- SCAN_N..................... 0x31 ... 49
- SCAN_M..................... 0x32 ... 50
- SCAN_COMMA................. 0x33 ... 51
- SCAN_PERIOD................ 0x34 ... 52
- SCAN_SLASH................. 0x35 ... 53
- SCAN_SHIFT_RIGHT........... 0x36 ... 54
- SCAN_KEYPAD_ASTERISK....... 0x37 ... 55
- SCAN_ALT................... 0x38 ... 56
- SCAN_SPACE................. 0x39 ... 57
- SCAN_CAPSLOCK.............. 0x3A ... 58
- SCAN_F1.................... 0x3B ... 59
- SCAN_F2.................... 0x3C ... 60
- SCAN_F3.................... 0x3D ... 61
- SCAN_F4.................... 0x3E ... 62
- SCAN_F5.................... 0x3F ... 63
- SCAN_F6.................... 0x40 ... 64
- SCAN_F7.................... 0x41 ... 65
- SCAN_F8.................... 0x42 ... 66
- SCAN_F9.................... 0x43 ... 67
- SCAN_F10................... 0x44 ... 68
- SCAN_NUMLOCK............... 0x45 ... 69
- SCAN_SCROLLOCK............. 0x46 ... 70
- SCAN_HOME.................. 0x47 ... 71
- SCAN_UP.................... 0x48 ... 72
- SCAN_PGUP.................. 0x49 ... 73
- SCAN_KEYPAD_MINUS.......... 0x4A ... 74
- SCAN_LEFT.................. 0x4B ... 75
- SCAN_KEYPAD_5.............. 0x4C ... 76
- SCAN_RIGHT................. 0x4D ... 77
- SCAN_KEYPAD_PLUS........... 0x4E ... 78
- SCAN_END................... 0x4F ... 79
- SCAN_DOWN.................. 0x50 ... 80
- SCAN_PGDN.................. 0x51 ... 81
- SCAN_INSERT................ 0x52 ... 82
- SCAN_DELETE................ 0x53 ... 83
- SCAN_SHIFT_F1.............. 0x54 ... 84
- SCAN_SHIFT_F2.............. 0x55 ... 85
- SCAN_SHIFT_F3.............. 0x56 ... 86
- SCAN_SHIFT_F4.............. 0x57 ... 87
- SCAN_SHIFT_F5.............. 0x58 ... 88
- SCAN_SHIFT_F6.............. 0x59 ... 89
- SCAN_SHIFT_F7.............. 0x5A ... 90
- SCAN_SHIFT_F8.............. 0x5B ... 91
- SCAN_SHIFT_F9.............. 0x5C ... 92
- SCAN_SHIFT_F10............. 0x5D ... 93
- SCAN_CTRL_F1............... 0x5E ... 94
- SCAN_CTRL_F2............... 0x5F ... 95
- SCAN_CTRL_F3............... 0x60 ... 96
- SCAN_CTRL_F4............... 0x61 ... 97
- SCAN_CTRL_F5............... 0x62 ... 98
- SCAN_CTRL_F6............... 0x63 ... 99
- SCAN_CTRL_F7............... 0x64 ... 100
- SCAN_CTRL_F8............... 0x65 ... 101
- SCAN_CTRL_F9............... 0x66 ... 102
- SCAN_CTRL_F10.............. 0x67 ... 103
- SCAN_ALT_F1................ 0x68 ... 104
- SCAN_ALT_F2................ 0x69 ... 105
- SCAN_ALT_F3................ 0x6A ... 106
- SCAN_ALT_F4................ 0x6B ... 107
- SCAN_ALT_F5................ 0x6C ... 108
- SCAN_ALT_F6................ 0x6D ... 109
- SCAN_ALT_F7................ 0x6E ... 110
- SCAN_ALT_F8................ 0x6F ... 111
- SCAN_ALT_F9................ 0x70 ... 112
- SCAN_ALT_F10............... 0x71 ... 113
- SCAN_CTRL_PRTSC............ 0x72 ... 114
- SCAN_CTRL_LEFT............. 0x73 ... 115
- SCAN_CTRL_RIGHT............ 0x74 ... 116
- SCAN_CTRL_END.............. 0x75 ... 117
- SCAN_CTRL_PGDN............. 0x76 ... 118
- SCAN_CTRL_HOME............. 0x77 ... 119
- SCAN_ALT_1................. 0x78 ... 120
- SCAN_ALT_2................. 0x79 ... 121
- SCAN_ALT_3................. 0x7A ... 122
- SCAN_ALT_4................. 0x7B ... 123
- SCAN_ALT_5................. 0x7C ... 124
- SCAN_ALT_6................. 0x7D ... 125
- SCAN_ALT_7................. 0x7E ... 126
- SCAN_ALT_8................. 0x7F ... 127
- SCAN_ALT_9................. 0x80 ... 128
- SCAN_ALT_0................. 0x81 ... 129
- SCAN_ALT_HYPHEN............ 0x82 ... 130
- SCAN_ALT_EQUAL............. 0x83 ... 131
- SCAN_CTRL_PGUP............. 0x84 ... 132
- SCAN_F11................... 0x85 ... 133
- SCAN_F12................... 0x86 ... 134
- SCAN_SHIFT_F11............. 0x87 ... 135
- SCAN_SHIFT_F12............. 0x88 ... 136
- SCAN_CTRL_F11.............. 0x89 ... 137
- SCAN_CTRL_F12.............. 0x8A ... 138
- SCAN_ALT_F11............... 0x8B ... 139
- SCAN_ALT_F12............... 0x8C ... 140
- SCAN_CTRL_UP............... 0x8D ... 141
- SCAN_CTRL_KEYPAD_MINUS..... 0x8E ... 142
- SCAN_CTRL_KEYPAD_5......... 0x8F ... 143
- SCAN_CTRL_KEYPAD_PLUS...... 0x90 ... 144
- SCAN_CTRL_DOWN............. 0x91 ... 145
- SCAN_CTRL_INS.............. 0x92 ... 146
- SCAN_CTRL_DEL.............. 0x93 ... 147
- SCAN_CTRL_TAB.............. 0x94 ... 148
- SCAN_CTRL_KEYPAD_SLASH..... 0x95 ... 149
- SCAN_CTRL_KEYPAD_ASTERISK.. 0x96 ... 150
- SCAN_ALT_HOME.............. 0x97 ... 151
- SCAN_ALT_UP................ 0x98 ... 152
- SCAN_ALT_PGUP.............. 0x99 ... 153
- SCAN_ALT_LEFT.............. 0x9B ... 155
- SCAN_ALT_RIGHT............. 0x9D ... 157
- SCAN_ALT_END............... 0x9F ... 159
- SCAN_ALT_DOWN.............. 0xA0 ... 160
- SCAN_ALT_PGDN.............. 0xA1 ... 161
- SCAN_ALT_INS............... 0xA2 ... 162
- SCAN_ALT_DEL............... 0xA3 ... 163
- SCAN_ALT_SLASH............. 0xA4 ... 164
- SCAN_ALT_TAB............... 0xA5 ... 165
- SCAN_ALT_ENTER............. 0xA6 ... 166
- SCAN_CTRL_ENTER............ 0xE0 ... 224
-
- --------------------------------------------------------------------------------
-
- /* ASCII GRAPHIC DEFINITIONS */
-
- HOUSE1L.... 0 ... house #1[left]
- HOUSE1R.... 1 ... house #1[right]
- TREE1...... 2 ... tree #1
- CAR1L...... 3 ... car #1[left]
- CAR1R...... 4 ... car #2[right]
- DINO1L..... 5 ... dinosaur #1[left]
- DINO1R..... 6 ... dinosaur #1[right]
- SHIP1N..... 7 ... ship #1[N]
- SHIP1NE.... 8 ... ship #1[NE]
- SHIP1E..... 9 ... ship #1[E]
- SHIP1SE... 10 ... ship #1[SE]
- SHIP1S.... 11 ... ship #1[S]
- SHIP1SW... 12 ... ship #1[SW]
- SHIP1W.... 13 ... ship #1[W]
- SHIP1NW... 14 ... ship #1[NW]
- BIRD1..... 15 ... bird #1
- DIAMON1... 16 ... diamond #1
- EXPLOS1... 17 ... explosion #1
- TOOTHG1... 18 ... toothgrin #1
- HOURGL1... 19 ... hourglass #1
- METEOR1... 20 ... meteor #1
- SPACES1... 21 ... spaceship #1
- BIKERL1... 22 ... biker #1[left]
- BIKERR1... 23 ... biker #1[right]
- FROWN1.... 24 ... frown #1
- GRIN1..... 25 ... grin #1
- LAMP1L.... 26 ... lamp #1[left]
- LAMP1R.... 27 ... lamp #1[right]
- SAILB1L... 28 ... sailboat #1[left]
- SAILB1R... 29 ... sailboat #1[right]
- SHARK1L... 30 ... shark #1[left]
- SHARK1R... 31 ... shark #1[right]
- TARGET1... 32 ... target #1
- TRUCK1L... 33 ... truck #1[left]
- TRUCK1R... 34 ... truck #1[right]
- VAN1L..... 35 ... van #1[left]
- VAN1R..... 36 ... van #1[right]
- BALLO11... 37 ... balloon #1[1]
- BALLO12... 38 ... balloon #1[2]
- BALLO13... 39 ... balloon #1[3]
- SUN1...... 40 ... sun #1
- FIGUR3L... 41 ... figure #3[left]
- FIGUR3R... 42 ... figure #3[right]
- FIGUR41... 43 ... figure #4[1]
- FIGUR42... 44 ... figure #4[2]
- FIGUR52... 45 ... figure #5[2]
- FISH1L.... 46 ... fish #1[left]
- FISH1R.... 47 ... fish #1[right]
- FISH2L.... 48 ... fish #2[left]
- FISH2R.... 49 ... fish #2[right]
- PLANE1L... 50 ... plane #1[left]
- PLANE1R... 51 ... plane #1[right]
- JET1L..... 52 ... jet #1[left]
- JET1R..... 53 ... jet #1[right]
- TARGET2... 54 ... target #2
- BOTTLE1... 55 ... bottle #1
- FIGUR1L... 56 ... figure #1[left]
- FIGUR1R... 57 ... figure #1[right]
- FIGUR2L... 58 ... figure #2[left]
- FIGUR2R... 59 ... figure #2[right]
- FIGUR51... 60 ... figure #5[1]
- FIGUR6L... 61 ... figure #6[left]
- FIGUR6R... 62 ... figure #6[right]
- MOON1L.... 63 ... moon #1[left]
- MOON1R.... 64 ... moon #1[right]
-
- byte codes[] = {
- (word)HOUSE1L, 192,126, /* house #1[left] */
- (word)HOUSE1R, 193,127, /* house #1[right] */
- (word)TREE1 , 194,145, /* tree #1 */
- (word)CAR1L , 195,146, /* car #1[left] */
- (word)CAR1R , 196,164, /* car #2[right] */
- (word)DINO1L , 197,165, /* dinosaur #1[left] */
- (word)DINO1R , 198,166, /* dinosaur #1[right] */
- (word)SHIP1N , 199,167, /* ship #1[N] */
- (word)SHIP1NE, 200,168, /* ship #1[NE] */
- (word)SHIP1E , 201,169, /* ship #1[E] */
- (word)SHIP1SE, 202,170, /* ship #1[SE] */
- (word)SHIP1S , 203,171, /* ship #1[S] */
- (word)SHIP1SW, 204,172, /* ship #1[SW] */
- (word)SHIP1W , 205,173, /* ship #1[W] */
- (word)SHIP1NW, 206,174, /* ship #1[NW] */
- (word)BIRD1 , 207,175, /* bird #1 */
- (word)DIAMON1, 208,179, /* diamond #1 */
- (word)EXPLOS1, 209,180, /* explosion #1 */
- (word)TOOTHG1, 210,181, /* toothgrin #1 */
- (word)HOURGL1, 211,182, /* hourglass #1 */
- (word)METEOR1, 212,183, /* meteor #1 */
- (word)SPACES1, 213,184, /* spaceship #1 */
- (word)BIKERL1, 214,185, /* biker #1[left] */
- (word)BIKERR1, 215,186, /* biker #1[right] */
- (word)FROWN1 , 216,187, /* frown #1 */
- (word)GRIN1 , 217,188, /* grin #1 */
- (word)LAMP1L , 218,189, /* lamp #1[left] */
- (word)LAMP1R , 219,190, /* lamp #1[right] */
- (word)SAILB1L, 220,191, /* sailboat #1[left] */
- (word)SAILB1R, 221,224, /* sailboat #1[right] */
- (word)SHARK1L, 222,225, /* shark #1[left] */
- (word)SHARK1R, 223,226, /* shark #1[right] */
- (word)
- (word)TARGET1, 192,126, /* target #1 */
- (word)TRUCK1L, 193,127, /* truck #1[left] */
- (word)TRUCK1R, 194,145, /* truck #1[right] */
- (word)VAN1L , 195,146, /* van #1[left] */
- (word)VAN1R , 196,164, /* van #1[right] */
- (word)BALLO11, 197,165, /* balloon #1[1] */
- (word)BALLO12, 198,166, /* balloon #1[2] */
- (word)BALLO13, 199,167, /* balloon #1[3] */
- (word)SUN1 , 200,168, /* sun #1 */
- (word)FIGUR3L, 201,169, /* figure #3[left] */
- (word)FIGUR3R, 202,170, /* figure #3[right] */
- (word)FIGUR41, 203,171, /* figure #4[1] */
- (word)FIGUR42, 204,172, /* figure #4[2] */
- (word)FIGUR52, 205,173, /* figure #5[2] */
- (word)FISH1L , 206,174, /* fish #1[left] */
- (word)FISH1R , 207,175, /* fish #1[right] */
- (word)FISH2L , 208,179, /* fish #2[left] */
- (word)FISH2R , 209,180, /* fish #2[right] */
- (word)PLANE1L, 210,181, /* plane #1[left] */
- (word)PLANE1R, 211,182, /* plane #1[right] */
- (word)JET1L , 212,183, /* jet #1[left] */
- (word)JET1R , 213,184, /* jet #1[right] */
-
- (word)TARGET2, 255, /* target #2 */
- (word)BOTTLE1, 254, /* bottle #1 */
- (word)FIGUR1L, 253, /* figure #1[left] */
- (word)FIGUR1R, 252, /* figure #1[right] */
- (word)FIGUR2L, 251, /* figure #2[left] */
- (word)FIGUR2R, 250, /* figure #2[right] */
- (word)FIGUR51, 249, /* figure #5[1] */
- (word)FIGUR6L, 248, /* figure #6[left] */
- (word)FIGUR6R, 247, /* figure #6[right] */
- (word)MOON1L , 246, /* moon #1[left] */
- (word)MOON1R , 245 /* moon #1[right] */
- };
-
- --------------------------------------------------------------------------------
-
- /* MESSAGES */
-
- DASHES printf("\n----------------------------------------
- ----------------------------------------")
- DISTRIBUTE printf("\n------------------------- DISTRIBUTION IS ENCOURAGED ----
- ---------------------")
- DOUBLESPACE printf("\n\n")
- SINGLESPACE printf("\n")
-
- --------------------------------------------------------------------------------
-
- /* MACROS */
-
- ischar(ch) (((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
- || ch == APOSTROPHE || ch == HYPHEN) ? TRUE : FALSE)
- RETURNS: TRUE if 'ch' is a valid character used in words
- FALSE if 'ch' is not a valid character used in words
-
-
- /* ONE-ARGUMENT MACROS */
-
- absolute value of a
- ABS(a) (((a)<0) ? -(a) : (a))
-
- round a to nearest integer towards 0
- FLOOR(a) ((a)>0 ? (int)(a) : -(int)(-a))
-
- round a to nearest integer away from 0
- CEILING(a) ( (a) == (int)(a) ? (a) \
- : (a) > 0 ? 1+(int)(a) : -( 1+(int)(-a) ))
-
- round a to nearest int
- ROUND(a) (((a) > 0) ? (int)(a+0.5) : -(int)(0.5-a))
-
- take sign of a, either -1, 0, or 1
- ZSGN(a) (((a) < 0) ? -1 : (a) > 0 ? 1 : 0)
-
- take binary sign of a, either -1, or 1 if >= 0
- SGN(a) (((a) < 0) ? -1 : 1)
-
- shout if something that should be true isn't
- ASSERT(x) if (!(x)) fprintf(stderr," Assert failed: x\n");
-
- square a
- SQR(a) ((a)*(a))
-
-
- /* TWO-ARGUMENT MACROS */
-
- return minimum of a and b
- MINIMUM(a,b) ( ((a) < (b)) ? (a) : (b) )
-
- return maximum of a and b
- MAXIMUM(a,b) ( ((a) > (b)) ? (a) : (b) )
-
- swap a and b
- SWAP(a,b) { a^=b; b^=a; a^=b; }
-
- linear interpolation from l (when a=0) to h (when a=1)
- (equal to (a*h) + ( (1-a) * l)
- LERP(a,l,h) ( (l) + (((h)-(l)) * (a)) )
-
- clamp the input to the specified range
- CLAMP(v,l,h) ( (v) < (l) ? (l) : (v) > (h) ? (h) : v)
-
-
- /* MEMORY ALLOCATION MACROS */
-
- create a new instance of a structure (see Gem by Hultquist)
- NEWSTRUCT(x) (struct x *) (malloc( (unsigned)sizeof(struct x) ))
-
- create a new instance of a type
- NEWTYPE(x) (x *) (malloc( (unsigned)sizeof(x) ))
-
- --------------------------------------------------------------------------------
-
- /* TYPE DEFINITIONS */
-
- typedef unsigned char boolean... a TRUE or FALSE type, as in Pascal
- typedef boolean flag............ flag data type
- typedef unsigned char byte...... an 8-bit/1 byte (0..255) type, as in Pascal
- typedef signed char shortint.... an 8-bit/1 byte (-128..+127) type, as in Pascal
- typedef unsigned int word....... a 16-bit/2-byte (0..65535) type, as in Pascal
-
- typedef struct {
- byte ascii................... ASCII code of character pressed
- byte scan.................... SCAN code of character pressed
- } asciiscan;
-
- typedef struct {
- byte y....................... ordinate
- byte x....................... abscissa
- byte start................... starting scan line
- byte end..................... ending scan line
- boolean on................... TRUE if the cursor is on, FALSE if it is not
- } cursordata;
-
- typedef struct document_def {
- char *line................... pointer to a line of the document
- struct document_def *prev..... pointer to previous line
- struct document_def *next..... pointer to next line
- } document;
-
- typedef struct {
- byte fgclr................. foreground color or NO if no color fill
- byte bgclr................. background color or NO if no color fill
- char fillchar.............. character to fill with or NO if no character fill
- byte x..................... abscissa (if TCUR, uses text cursor abscissa
- if MCUR, uses mouse cursor abscissa)
- byte y..................... ordinate (if TCUR, uses text cursor ordinate
- if MCUR, uses mouse cursor ordinate)
- shortint length............ x-length of area
- shortint height............ y-height of area
- char *overwrite............ text to overwrite or NULL if overwrite all
- char *text................. text to print or NULL if no text
- } filldata;
- *** NOTE if "fillchar" and "print" are both defined, "print" is printed
-
- typedef struct {
- word size............... size of image in bytes
- byte tclr............... transparency color or number of 8-pixel groups
- int x................... abscissa (if MCUR, uses mouse cursor abscissa)
- int y................... ordinate (if MCUR, uses mouse cursor ordinate)
- int length.............. x-length (do not modify)
- int height.............. y-height (do not modify)
- int how : 1............. draw with the current scroll (TRUE) or not (FALSE)
- int for_future : 15..... no current purpose, other than to fill the integer
- } imagedata;
- *** NOTE if used with _16_i_... "tclr" is number of 8-pixel groups per row
- if used with _16_c_... or _16_p_..., "tclr" is transparency color
-
- typedef struct linked_list {
- struct linked_list *next...... pointer to next node
- } llist;
-
- typedef struct linked_list_s {
- struct linked_list_s *next.... pointer to next node
- } llist_single;
-
- typedef struct linked_list_d {
- struct linked_list_d *prev.... pointer to previous node
- struct linked_list_d *next.... pointer to next node
- } llist_double;
-
- typedef struct {
- byte update............. TRUE "ms_stat" has updated structure "mousedata"
- FALSE no structure variables have been updated
- int pos[2].............. old mouse cursor x,y position
- int buts[2]............. old left,right button 0 not pressed 1 pressed
- int npos[2]............. new mouse cursor x,y position
- int nbuts[2]............ new left,right button 0 not pressed 1 pressed
- int butlr[2]............ x,y position of last left button release
- int butlp[2]............ x,y position of last left button press
- int butrr[2]............ x,y position of last right button release
- int butrp[2]............ x,y position of last right button press
- } mousedata;
-
- typedef struct {
- byte fgclr.............. foreground color or NO if no color fill
- byte bgclr.............. background color or NO if no color fill
- byte command = ALIGN_NONE - no command
- = ALIGN_HORZ - horizontal center; shifts odd lengths left
- = ALIGN_VERT - vertical center; shifts odd lengths up
- = ALIGN_CENTER - horizontal and vertical center
- = ALIGN_RIGHT - right justify; flush to the right margin
- byte x.................. abscissa (if TCUR, uses text cursor abscissa
- if MCUR, uses mouse cursor abscissa)
- byte y.................. ordinate (if TCUR, uses text cursor ordinate
- if MCUR, uses mouse cursor ordinate)
- char *text.............. text to print
- } printdata;
- *** NOTE "command" will revert to ALIGN_NONE if the length of string "string"
- is greater than 80 (the width of the text screen)
- *** NOTE if both "x" and "y" = TCUR, the cursor is advanced to one past the
- last character printed
-
- typedef struct {
- word size............... size of image in bytes
- byte fgclr.............. NO if no color fill
- byte bgclr.............. NO if no color fill
- byte x.................. abscissa (if TCUR, uses text cursor abscissa
- if MCUR, uses mouse cursor abscissa)
- byte y.................. ordinate (if TCUR, uses text cursor ordinate
- if MCUR, uses mouse cursor ordinate)
- byte length............. x-length (do not modify)
- byte height............. y-height (do not modify)
- } textimagedata;
-
- typedef struct {
- byte fgclr.............. foreground color or NO if no color fill
- byte bgclr.............. background color or NO if no color fill
- byte x.................. abscissa (if TCUR, uses text cursor abscissa
- if MCUR, uses mouse cursor abscissa)
- byte y.................. ordinate (if TCUR, uses text cursor ordinate
- if MCUR, uses mouse cursor ordinate)
- } textstr;
-
- typedef struct {
- byte fgclr, bgclr................. color of text inside window
- x, y......................... top,left coordinates of window
- length, height............... length and height of window
- parts........................ window parts to use
- shadow_style................. shadow style
- border_fgclr, border_bgclr... color of border
- shadow_fgclr, shadow_bgclr... color of shadow
- title_fgclr, title_bgclr..... color of title
- char *border...................... border characters
- *shadow...................... shadow characters
- *title....................... window title
- document *text.................... pointer to text of window
- } window_data;
-
-
- /* 2-D GEOMETRY TYPES */
-
- typedef struct point2_struct { /* 2d point */
- double x, y;
- } point2;
-
- typedef point2 vector2;
-
- typedef struct point2_int_struct { /* 2d integer point */
- int x, y;
- } point2_int;
-
- typedef struct matrix3_struct { /* 3-by-3 matrix */
- double element[3][3];
- } matrix3;
-
- typedef struct box2d_struct { /* 2d box */
- point2 min, max;
- } box2;
-
-
- /* 3-D GEOMETRY TYPES */
-
- typedef struct point3_struct { /* 3d point */
- double x, y, z;
- } point3;
-
- typedef point3 vector3;
-
- typedef struct point3_int_struct { /* 3d integer point */
- int x, y, z;
- } point3_int;
-
- typedef struct matrix4_struct { /* 4-by-4 matrix */
- double element[4][4];
- } matrix4;
-
- typedef struct box3d_struct { /* 3d box */
- point3 min, max;
- } box3;
-
- --------------------------------------------------------------------------------
-
- /* GLOBAL VARIABLE DEFINITIONS */
-
- volatile external boolean blink default is TRUE
- blink = TRUE if blinking characters and 8 background colors
- else blink = FALSE if no blinking characters and 16 background colors
-
- volatile extern boolean mousepresent default is FALSE
- mousepresent = TRUE if mouse is detected by function "ms_init"
- else mousepresent = FALSE if mouse is not found by function "ms_init"
-
- volatile extern word chr_output default is MAX
- chr_output = maximum number of characters to print with any output subfunction
- (useful for windowing text)
- = MAX for no limit on the number of characters to print
-
- volatile external boolean txt_cur_move default is TRUE
- txt_cur_move = TRUE if text cursor will move if x = y = TCUR
- else txt_cur_move = FALSE if text cursor will not move if x = y = TCUR
-
- volatile extern word txt_length default is 80
- character width of virtual text screen (used when smooth scrolling)
-
- ================================================================================
-
-
- =================================------------===================================
- ----------------------------------- FILE -------------------------------------
- ------------
- FILE *fil_count(char *filename,
- char *title, char *author, char *msgs[], word msg_num);
- Function: Report the number of program executions, print a random comment, and
- and print the amount of memory available.
-
- FILE *fil_count_reg(char *filename, char *title, char *author, char *registree);
- Function: Report the number of program executions, print to whom the program
- is registered to, and print the amount of memory available.
-
- Arguments: = opens the data file "filename" and increment the number of program
- executions
- = the program title "title" and the author name "author" is used in
- all messages referencing this information
- = fil_count - one of "msg_num" messages stored in "msgs" will be
- printed (chosen randomly)
- = fil_count_reg - prints to whom the program is registered to
-
- Notes: The file pointer is set to just after the first integer (the program
- execution counter). NOTE #include <alloc.h> must be present in the
- module that calls this function or the reported amount of available
- memory will be inaccurate. If a file error occurs, an exit to DOS, with
- the appropriate message and ERRORLEVEL=1, will follow.
-
- Return Value: = file handle of data file
-
- --------------------------------------------------------------------------------
- FILE
- long fil_len(FILE *f);
- Function: Return the length of a file, in bytes.
-
- Arguments: = "f" - file handle of file to return to length of
-
- Notes: The current position of the file is not modified.
-
- Return Value: = length of file, in bytes
-
- --------------------------------------------------------------------------------
- FILE
- char *fil_next_str(word *size, FILE *f);
- Function: Return the next string from the current file position.
-
- char *fil_next_word(word *size, FILE *f);
- Function: Return the next word from the current file position.
-
- Arguments: = "size" - initial size of input buffer
- = "f" - file handle to read from
-
- Notes: A string can consist of alphanumeric characters, hyphens, apostrophes, or
- text surrounded in quotes, like "It is: 04/12/94" -- nothing else. A
- word can consist of only alphabet letters. If the input buffer ever
- becomes full, it is increased by "size" bytes. "size" is modified to the
- new size.
-
- Return Value: = pointer to word read in (file pointer is set to the byte just
- after the word)
- = NULL if no word was found (file pointer is set to EOF)
-
- See Also: fil_read_to
-
- --------------------------------------------------------------------------------
- FILE
- char *fil_read_to(char *str, word *size, FILE *f);
- Function: Return from the current file position upto the first occurrence of a
- string.
-
- char *fil_read_to_strip(char *str, word *size, FILE *f);
- Function: Return from the current file position upto the first occurrence of a
- string, stripping all comments (beginning with a ';'), blank lines,
- and extra spaces, and strip all spaces surrounding '=' (equal signs).
-
- Arguments: = "str" - string to read up to
- = "size" - initial size of input buffer
- = "f" - file handle to read from
-
- Notes: If the input buffer ever becomes full, it is increased by "size" bytes.
- "size" is modified to the new size.
- For "fil_read_to_strip", an example of what is stripped:
-
- This is "not; [I] = say" ;he said
- [not [" I"] say]
-
- to = this.
-
- becomes:
-
- This is "not; [I] = say"
- [not [" I"] say]
- to=this.
-
- - Text inside quotation marks (ie. string) is unaltered ('[' ']' are also
- considered to be quotation marks)
- - note that these may be nested, and the actual quotation marks are
- considered to be the outside ones
-
- Return Value: = pointer to contents of file read in (file pointer is set to the
- byte just after the match)
- = NULL if no match was found (file pointer is set to EOF)
-
- See Also: fil_next_word fil_skip_to
-
- --------------------------------------------------------------------------------
- FILE
- word fil_skip_past(char *str, FILE *f);
- Function: Search from the current file position for the first occurrence of a
- string, and set the file pointer to just past it.
-
- Arguments: = "str" - string to skip past
- = "f" - file handle to read from
-
- Return Value: = number of bytes acanned upto (and including) last byte of match
- (file pointer is set to byte just after match)
- = FALSE if no match was found (file pointer is set to EOF)
-
- See Also: fil_skip_to
-
- --------------------------------------------------------------------------------
- FILE
- word fil_skip_to(char *str, FILE *f);
- Function: Search from the current file position for the first occurrence of a
- string, and set the file pointer to the beginning of it.
-
- Arguments: = "str" - string to skip to
- = "f" - file handle to read from
-
- Return Value: = number of bytes acanned upto (and including) first byte of match
- (file pointer is set to first byte of match)
- = FALSE if no match was found (file pointer is set to EOF)
-
- See Also: fil_read_to fil_skip_past
-
- ================================================================================
- --------------------------------- INI FILE -----------------------------------
-
- boolean ini_get_boolean(char *section, char *section_title, char *option);
- Function: Translate the boolean word "TRUE" or "FALSE" into the boolean
- numerical value TRUE or FALSE, respectively.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the boolean from option "option" is read
-
- Notes: Only "TRUE" or "FALSE" are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = FALSE if found string "FALSE"
- = TRUE if found string "TRUE"
-
- See Also: ini_get_color ini_get_number
-
- --------------------------------------------------------------------------------
- INI FILE
- byte ini_get_color(char *section, char *section_title, char *option);
- Function: Translate a color name into its numerical equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the color from option "option" is read
-
- Notes: Only "BLACK", "BLUE", "GREEN", "CYAN", "RED", "MAGENTA", "BROWN",
- "LIGHTGREY", "DARKGREY", "LIGHTBLUE", "LIGHTGREEN", "LIGHTCYAN",
- "LIGHTRED", "LIGHTMAGENTA", "YELLOW", and "WHITE" are recognized. See
- the function "ini_read_section" for an example of a typical .INI file,
- where section titles, options, and parameters are explained.
-
- Return Value: = numerical equivalent of color name
-
- See Also: ini_get_boolean
-
- --------------------------------------------------------------------------------
- INI FILE
- int ini_get_number(char *section, char *section_title, char *option);
- Function: Translate an ASCII representation of a number into its numerical
- representation.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the number from option "option" is read
-
- Notes: Only decimal number strings are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = numerical representation of number string
-
- See Also: ini_get_boolean ini_get_position ini_get_rows
-
- --------------------------------------------------------------------------------
- INI FILE
- int ini_get_position(char *section, char *section_title, char *option);
- Function: Translate the screen position "TOP" or "BOTTOM" into its row number
- equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the screen position from option "option"
- is read
-
- Notes: Only "TOP" or "BOTTOM" are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = screen row number
-
- See Also: ini_get_number
-
- --------------------------------------------------------------------------------
- INI FILE
- int ini_get_rows(char *section, char *section_title, char *option);
- Function: Translate the number of rows per screen "25", "50", or "UNMODIFY" into
- its numerical equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the number of rows per screen from option
- "option" is read
-
- Notes: Only "25", "50", or "UNMODIFY" are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = 25 if found string "25"
- = 50 if found string "50"
- = current number of rows per screen if found string "UNMODIFY"
-
- See Also: ini_get_position ini_get_state
-
- --------------------------------------------------------------------------------
- INI FILE
- int ini_get_state(char *section, char *section_title, char *option);
- Function: Translate the keyboard state "ON", "OFF", or "UNMODIFY" into a
- numerical equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the keyboard state from option "option"
- is read
-
- Notes: Only "ON", "OFF", or "UNMODIFY" are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = 0 if found string "ON"
- = 1 if found string "OFF"
- = 2 if found string "UNMODIFY"
-
- See Also: ini_get_rows
-
- --------------------------------------------------------------------------------
- INI FILE
- byte ini_get_state(char *section, char *section_title, char *option);
- Function: Translate the keyboard state "ON", "OFF", or "UNMODIFY" into its
- numerical equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the keyboard state from option "option"
- is read
-
- Notes: Only "ON", "OFF", or "UNMODIFY" are recognized. See the function
- "ini_read_section" for an example of a typical .INI file, where section
- titles, options, and parameters are explained.
-
- Return Value: = 0 if found string "OFF"
- = 1 if found string "ON"
- = 2 if found string "UNMODIFY"
-
- See Also: ini_get_position ini_get_yesno
-
- --------------------------------------------------------------------------------
- INI FILE
- char *ini_get_text(char *section, char *section_title, char *option);
- Function: Translate a string surrounded by quotes into a string not surrounded
- by quotes.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the quote-enclosed string from option
- "option" is read
-
- Notes: See the function "ini_read_section" for an example of a typical .INI
- file, where section titles, options, and parameters are explained.
-
- Return Value: = string with end-quotes removed
-
- See Also: ini_get_yesno
-
- --------------------------------------------------------------------------------
- INI FILE
- boolean ini_get_yesno(char *section, char *section_title, char *option);
- Function: Translate the response "YES" or "NO into its numerical equivalent.
-
- Arguments: = from .INI file section "section", specifically under the section
- entitled "section_title", the response from option "option" is read
-
- Notes: Only "YES" or "NO" are recognized. See the function "ini_read_section"
- for an example of a typical .INI file, where section titles, options, and
- parameters are explained.
-
- Return Value: = TRUE if found string "YES"
- = FALSE if found string "NO"
-
- See Also: ini_get_state ini_get_text
-
- --------------------------------------------------------------------------------
- INI FILE
- char *ini_read_section(char *str1, char *str2, FILE *f);
- Function: Read in the relevant information of a section.
-
- Arguments: = from .INI file handle "f", the section, beginning with the string
- "str1" and ending with the string "str2", is read in and returned.
-
- Notes: The information is read via a call to the function "fil_read_to_strip";
- see that function's documentation for what is stripped and what is kept.
-
- Return Value: = relevant section text
-
- See Also: ini_read_keystore
-
- EXAMPLE OF A TYPICAL .INI FILE FORMAT
- ------------------------------
-
- /* this is a comment, and not part of the .INI file */
-
- ------------------------------
-
- [EDIT WINDOW] begin
-
- /* ^----- this is a section beginning, but can also serve as a section title */
-
- Rows = UNMODIFY ;number of rows per screen page (can be 25 or 50)
- RightMargin = 80 ;right margin
-
- /* ^------ UNMODIFY and 80 are parameters associated with options */
- /* ^----- the above two are options within a section */
-
- [Initial State] ;initial keyboard status
- CAPSLock = UNMODIFY ; initial state of the CAPS Lock
- Insert = ON ; initial state of Insert
-
- [End Of File] ;end-of-file message
- BGColor = BLACK ; background color
- FGColor = WHITE ; foreground color
- Text = "<≡≡≡ End-Of-File ≡≡≡>" ; text to represent end-of-file
-
- [EDIT WINDOW] end
-
- ------------------------------
-
- [MENU] begin
-
- Show = YES ;always show main menu?
- Position = TOP ;position of menu on screen (TOP or BOTTOM)
-
- [Normal Text] ;normal menu text
- BGColor = BLACK ; background color
- FGColor = LIGHTGREY ; foreground color
- ; main menu items
- Text = " ≡ File Case Control Line Draw Miscellaneous Help "
-
- [MENU] end
-
- ------------------------------
-
- ================================================================================
-
-
- ===============================----------------=================================
- --------------------------------- KEYBOARD -----------------------------------
- ----------------
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_all_off(void);
- Function: Disable all of the three LOCKS (CAPS LOCK, NUM LOCK, and SCROLL
- LOCK) and turns all of these lights off.
-
- void kbd_all_on(void);
- Function: Enable all of the three LOCKS (CAPS LOCK, NUM LOCK, and SCROLL LOCK)
- and turns all of these lights on.
-
- See Also: kbd_is_all_on kbd_caps_off kbd_insert_off kbd_num_off kbd_scroll_off
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_caps_off(void);
- Function: Disable the CAPS LOCK key and turns off its light.
-
- void kbd_caps_on(void);
- Function: Enable the CAPS LOCK key and turns on its light.
-
- See Also: kbd_is_caps_on kbd_all_off kbd_insert_off kbd_num_off kbd_scroll_off
-
- --------------------------------------------------------------------------------
- KEYBOARD
- char kbd_clear(void);
- Function: Clear the keyboard buffer of all keystrokes.
-
- Notes: The keyboard buffer is completely emptied. This is used in common DOS
- functions, such as "Are you sure (Y/N)?" before a "del *.*". It
- ensures the user did not accidentally type a key that he did not wish
- to be "remembered" for the next question.
-
- Return Value: = ASCII code of the last character that was in the buffer
-
- See Also: kbd_hit
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_give(void);
- Function: Give control back to the original keyboard interrupt.
-
- See Also: kbd_take
-
- --------------------------------------------------------------------------------
- KEYBOARD
- char kbd_hit(void);
- Function: Check the keyboard buffer to see if a key has been pressed.
-
- Notes: The keypress detected is not removed from the keyboard buffer (ie. a
- second call to "kbd_hit" would still return TRUE). To remove the key
- from the keyboard buffer, call "getchr" or "getchre".
-
- Return Value: = ASCII value of key, if a key has been pressed
- = 0 if no key has been pressed
-
- See Also: getchr kbd_clear
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_insert_off(void);
- Function: Disable the INSERT key and turns off its light.
-
- void kbd_insert_on(void);
- Function: Enable the INSERT key and turns on its light.
-
- See Also: kbd_is_insert_on kbd_all_off kbd_caps_off kbd_num_off kbd_scroll_off
-
- ---------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_all_on(void);
- Function: Report if all of the three LOCKS (CAPS LOCK, NUM LOCK, and
- SCROLL LOCK) are active.
-
- Return Value: = TRUE - all three LOCKS are active
- = FALSE - all three LOCKS are not active
-
- See Also: kbd_is_alt kbd_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_num_on kbd_is_scroll_on
-
- ---------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_alt(void);
- Function: Report if either alt is depressed.
-
- boolean kbd_is_alt_only(void);
- Function: Report if only an alt is depressed (and not a ctrl or a shift).
-
- boolean kbd_is_alt_left(void);
- Function: Report if the left alt is depressed.
-
- boolean kbd_is_alt_left_only(void);
- Function: Report if only the left alt is depressed (and not the right alt, a
- ctrl, or a shift).
-
- boolean kbd_is_alt_right(void);
- Function: Report if the right alt is depressed.
-
- boolean kbd_is_alt_right_only(void);
- Function: Report if only the right alt is depressed (and not the left alt, a
- ctrl, or a shift).
-
- Return Value: = kbd_is_alt - TRUE - an alt is depressed
- - FALSE - an alt is not depressed
- kbd_is_alt_only - TRUE - only alt is depressed
- - FALSE - alt is not the only mode key
- depressed
- kbd_is_alt_left - TRUE - left alt is depressed
- - FALSE - left alt is not depressed
- kbd_is_alt_left_only - TRUE - only left alt is depressed
- - FALSE - left alt is not the only mode key
- depressed
- kbd_is_alt_right - TRUE - right alt is depressed
- - FALSE - right alt is not depressed
- kbd_is_alt_right_only - TRUE - only right alt is depressed
- - FALSE - right alt is not the only mode key
- depressed
-
- See Also: kbd_is_all_on kbd_is_ctrl kbd_is_shift
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_caps_on(void);
- Function: Report if CAPS LOCK is active.
-
- Return Value: = TRUE - CAPS LOCK is active
- = FALSE - CAPS LOCK is not active
-
- See Also: kbd_caps_on kbd_is_all_on kbd_is_insert_on kbd_is_num_on kbd_is_scroll_on
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_ctrl(void);
- Function: Report if either ctrl is depressed.
-
- boolean kbd_is_ctrl_only(void);
- Function: Report if only a ctrl is depressed (and not an alt or a shift).
-
- boolean kbd_is_ctrl_left(void);
- Function: Report if the left ctrl is depressed.
-
- boolean kbd_is_ctrl_left_only(void);
- Function: Report if only the left ctrl is depressed (and not the right ctrl, a
- ctrl, or a shift).
-
- boolean kbd_is_ctrl_right(void);
- Function: Report if the right ctrl is depressed.
-
- boolean kbd_is_ctrl_right_only(void);
- Function: Report if only the right ctrl is depressed (and not the left ctrl, a
- ctrl, or a shift).
-
- Return Value: = kbd_is_ctrl - TRUE - a ctrl is depressed
- - FALSE - a ctrl is not depressed
- kbd_is_ctrl_only - TRUE - only ctrl is depressed
- - FALSE - ctrl is not the only mode key
- depressed
- kbd_is_ctrl_left - TRUE - left ctrl is depressed
- - FALSE - left ctrl is not depressed
- kbd_is_ctrl_left_only - TRUE - only left ctrl is depressed
- - FALSE - left ctrl is not the only mode key
- depressed
- kbd_is_ctrl_right - TRUE - right ctrl is depressed
- - FALSE - right ctrl is not depressed
- kbd_is_ctrl_right_only - TRUE - only right ctrl is depressed
- - FALSE - right ctrl is not the only mode key
- depressed
- See Also: kbd_is_alt kbd_is_shift
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_insert_on(void);
- Function: Report if INSERT is active.
-
- Return Value: = TRUE - INSERT is active
- = FALSE - INSERT is not active
-
- See Also: kbd_insert_on kbd_is_all_on kbd_is_caps_on kbd_is_num_on kbd_is_scroll_on
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_num_on(void);
- Function: Report if NUM LOCK is active.
-
- Return Value: = TRUE - NUM LOCK is active
- = FALSE - NUM LOCK is not active
-
- See Also: kbd_num_on kbd_is_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_scroll_on
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_scroll_on(void);
- Function: Report if SCROLL LOCK is active.
-
- Return Value: = TRUE - SCROLL LOCK is active
- = FALSE - SCROLL LOCK is not active
-
- See Also: kbd_scroll_on kbd_is_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_num_on
-
- --------------------------------------------------------------------------------
- KEYBOARD
- boolean kbd_is_shift(void);
- Function: Report if either shift is depressed.
-
- boolean kbd_is_shift_only(void);
- Function: Report if only a shift is depressed (and not an alt or a ctrl).
-
- boolean kbd_is_shift_left(void);
- Function: Report if the left shift is depressed.
-
- boolean kbd_is_shift_left_only(void);
- Function: Report if only the left shift is depressed (and not the right shift,
- an alt, or a ctrl).
-
- boolean kbd_is_shift_right(void);
- Function: Report if the right shift is depressed.
-
- boolean kbd_is_shift_right_only(void);
- Function: Report if only the right shift is depressed (and not the left shift,
- an alt, or a ctrl).
-
- Return Value: = kbd_is_shift - TRUE a shift is depressed
- - FALSE a shift is not depressed
- = kbd_is_shift_only - TRUE only a shift is depressed
- - FALSE shift is not the only mode key
- depressed
- = kbd_is_shift_left - TRUE left shift is depressed
- - FALSE left shift is not depressed
- = kbd_is_shift_left_only - TRUE only left shift is depressed
- - FALSE left shift is not the only mode
- key depressed
- = kbd_is_shift_right - TRUE right shift is depressed
- - FALSE right shift is not depressed
- = kbd_is_shift_right_only - TRUE only right shift is depressed
- - FALSE right shift is not the only mode
- key depressed
-
- See Also: kbd_is_alt kbd_is_ctrl
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_num_off(void);
- Function: Disable the NUM LOCK key and turns off its light.
-
- void kbd_num_on(void);
- Function: Enable the NUM LOCK key and turns on its light.
-
- See Also: kbd_is_num_on kbd_all_off kbd_caps_off kbd_insert_off kbd_scroll_off
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_rate(byte rate, byte delay);
- Function: Set typematic rate and typematic delay for repeat-key action.
-
- Arguments: = typematic rate "rate" determines how many characters per second are
- printed, according to the following chart:
- +------+-----------++------+-----------++------+-----------++------+-----------+
- | rate | chars/sec || rate | chars/sec || rate | chars/sec || rate | chars/sec |
- +------+-----------++------+-----------++------+-----------++------+-----------+
- | 0 | 30.0 || 8 | 15.0 || 16 | 7.5 || 24 | 3.7 |
- | 1 | 26.7 || 9 | 13.3 || 17 | 6.7 || 25 | 3.3 |
- | 2 | 24.0 || 10 | 12.0 || 18 | 6.0 || 26 | 3.0 |
- | 3 | 21.8 || 11 | 10.9 || 19 | 5.5 || 27 | 2.7 |
- | 4 | 20.0 || 12 | 10.0 || 20 | 5.0 || 28 | 2.5 |
- | 5 | 18.5 || 13 | 9.2 || 21 | 4.6 || 29 | 2.3 |
- | 6 | 17.1 || 14 | 8.6 || 22 | 4.3 || 30 | 2.1 |
- | 7 | 16.0 || 15 | 8.0 || 23 | 4.0 || 31 | 2.0 |
- +------+-----------++------+-----------++------+-----------++------+-----------+
- = typematic delay "delay" determines how many milliseconds before the
- the repeat-key action begins, according to the following chart:
- +-------+----------+
- | delay | millisec |
- +-------+----------+
- | 0 | 250 |
- | 1 | 500 |
- | 2 | 750 |
- | 3 | 1000 |
- +-------+----------+
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_scroll_off(void);
- Function: Disable the SCROLL LOCK key and turns off its light.
-
- void kbd_scroll_on(void);
- Function: Enable the SCROLL LOCK key and turns on its light.
-
- See Also: kbd_is_scroll_on kbd_all_off kbd_caps_off kbd_insert_off kbd_num_off
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_status_load(void);
- Function: Restore the previously saved keyboard status of insert, caps lock, num
- lock, and scroll lock
-
- void kbd_status_save(void);
- Function: Save the current keyboard status of insert, caps lock, num lock, and
- scroll lock
-
- --------------------------------------------------------------------------------
- KEYBOARD
- void kbd_take(void);
- Function: Take control of the keyboard interrupt.
-
- See Also: kbd_give
-
- ---------------------------------------------------------------------------------
- KEYBOARD
- char getchr(void);
- Function: Get the next available keypress; if none available, wait for one.
-
- char getchre(byte x, byte y);
- Function: Get the next available keypress and echo it to the screen; if no
- keypress available, wait for one.
-
- Arguments: = getchre - the character in the buffer is printed at "x","y"
-
- Notes: "getchr" and "getchre" store the ASCII and scan codes of the character
- in the keyboard buffer into the structure "asciiscan" (see Global Type
- Definitions for a description of the structure "asciiscan").
-
- Return Value: = getchr - ASCII code of character retrieved from keyboard
- getchre - buffer
-
- See Also: kbd_hit
-
- ================================================================================
-
-
- ===============================-----------------================================
- -------------------------------- LINKED LIST ---------------------------------
- -----------------
- llist *lst_find(llist *node, llist *list);
- Function: Search for a node of a linked list.
-
- Arguments: = search for node "node" in linked list "list"
-
- Return Value: = "node" of linked list
- = NULL if "node" not found in linked list
-
- See Also: lst_end
-
- --------------------------------------------------------------------------------
- LINKED LIST
- llist_double *lst_free_double(llist_double *list);
- Function: Deallocate each node of a doubly linked list.
-
- Arguments: = deallocate doubly linked list "list"
-
- Return Value: = NULL
-
- See Also: lst_free_single lst_unlink_double
-
- --------------------------------------------------------------------------------
- LINKED LIST
- llist_single *lst_free_single(llist_single *list);
- Function: Deallocate each node of a singly linked list.
-
- Arguments: = deallocate singly linked list "list"
-
- Return Value: = NULL
-
- See Also: lst_end lst_free_double
-
- --------------------------------------------------------------------------------
- LINKED LIST
- llist *lst_tail(llist *list);
- Function: Return the tail of a linked list.
-
- Arguments: = use linked list "list"
-
- Return Value: = tail of linked list
-
- See Also: lst_find lst_free_single
-
- --------------------------------------------------------------------------------
- LINKED LIST
- llist_double *lst_unlink_double(llist_double **head, llist_double *unlink);
- Function: Unlink a node from a doubly linked list.
-
- Arguments: = unlink node "unlink" from doubly linked list who's head is pointed
- to by "head"
-
- Return Value: = next node in linked list
- = NULL if no further nodes in linked list
-
- See Also: lst_free_double lst_unlink_single
-
- --------------------------------------------------------------------------------
- LINKED LIST
- llist_single *lst_unlink_single(llist_single **head, llist_single *unlink);
- Function: Unlink a node from a singly linked list.
-
- Arguments: = unlink node "unlink" from singly linked list who's head is pointed
- to by "head"
-
- Return Value: = next node in linked list
- = NULL if no further nodes in linked list
-
- See Also: lst_unlink_double
-
- ================================================================================
-
-
- ==================================----------====================================
- ----------------------------------- MATH -------------------------------------
- ----------
- byte max_byte(word nums, byte num1, ...);
- Function: Return the maximum of a list of bytes.
-
- int max_int(word nums, int num1, ...);
- Function: Return the maximum of a list of integers.
-
- shortint max_shortint(word nums, shortint num1, ...);
- Function: Return the maximum of a list of short integers.
-
- word max_word(word nums, word num1, ...);
- Function: Return the maximum of a list of words.
-
- Arguments: = number of numbers "nums", beginning with "num1"
-
- Return Value: = greatest number of the list
-
- See Also: min_byte
-
- --------------------------------------------------------------------------------
- MATH
- byte min_byte(word nums, byte num1, ...);
- Function: Return the minimum of a list of bytes.
-
- int min_int(word nums, int num1, ...);
- Function: Return the minimum of a list of integers.
-
- shortint min_shortint(word nums, shortint num1, ...);
- Function: Return the minimum of a list of short integers.
-
- word min_word(word nums, word num1, ...);
- Function: Return the minimum of a list of words.
-
- Arguments: = number of numbers "nums", beginning with "num1"
-
- Return Value: = smallest number of the list
-
- See Also: max_byte
-
- ================================================================================
- ---------------------------------- MATRIX -------------------------------------
-
- matrix3 *m3_add( matrix3 *A, matrix3 *B, matrix3 *C )
- Function: Add two 3x3 matrices.
-
- Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" + "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A + B
-
- See Also: m3_mul m3_sub m4_add
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_det( matrix3 *A, matrix3 *B )
- Function: Return the determinant of a 3x3 matrix.
-
- Arguments: = 3x3 matrix "B" equals the determinant of the 3x3 matrix "A"
-
- Notes: "B" is assigned the return value.
-
- Return Value: = det(B)
-
- See Also: m4_det
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_div( matrix3 *A, matrix3 *B, matrix3 *C )
- Function: Divide two 3x3 matrices.
-
- Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" / "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A / B
-
- See Also: m3_mul m3_sub m4_div
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_inv( matrix3 *A, matrix3 *B )
- Function: Return the inverse of a 3x3 matrix.
-
- Arguments: = 3x3 matrix "B" equals the inverse of the 3x3 matrix "A"
-
- Notes: "B" is assigned the return value.
-
- -1
- Return Value: = B^ or inv(B)
-
- See Also: m4_inv
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_mul( matrix3 *A, matrix3 *B, matrix3 *C )
- Function: Multiply two 3x3 matrices.
-
- Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" * "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A * B
-
- See Also: m3_add m3_div m4_mul
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_sub( matrix3 *A, matrix3 *B, matrix3 *C )
- Function: Subtract two 3x3 matrices.
-
- Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" - "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A - B
-
- See Also: m3_div m3_add m4_sub
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix3 *m3_transpose( matrix3 *A, matrix3 *B)
- Function: Transpose a 3x3 matrix.
-
- Arguments: = 3x3 matrix "B" equals the transpose of the 3x3 matrices "A"
-
- Notes: "B" is assigned the return value.
-
- Return Value: = transpose(A)
-
- See Also: m4_transpose
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_add( matrix4 *A, matrix4 *B, matrix4 *C )
- Function: Add two 4x4 matrices.
-
- Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" + "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A + B
-
- See Also: m3_add m4_mul m4_sub
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_det( matrix4 *A, matrix4 *B )
- Function: Return the determinant of a 4x4 matrix.
-
- Arguments: = 4x4 matrix "B" equals the determinant of the 4x4 matrix "A"
-
- Notes: "B" is assigned the return value.
-
- Return Value: = det(B)
-
- See Also: m3_det
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_div( matrix4 *A, matrix4 *B, matrix4 *C )
- Function: Divide two 4x4 matrices.
-
- Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" / "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A / B
-
- See Also: m3_div m4_mul m4_sub
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_mul( matrix4 *A, matrix4 *B, matrix4 *C )
- Function: Multiply two 4x4 matrices.
-
- Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" * "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A * B
-
- See Also: m3_mul
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_inv( matrix4 *A, matrix4 *B )
- Function: Return the inverse of a 4x4 matrix.
-
- Arguments: = 4x4 matrix "B" equals the inverse of the 4x4 matrix "A"
-
- Notes: "B" is assigned the return value.
-
- -1
- Return Value: = B^ or inv(B)
-
- See Also: m3_inv
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_sub( matrix4 *A, matrix4 *B, matrix4 *C )
- Function: Subtract two 4x4 matrices.
-
- Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" - "B"
-
- Notes: "C" is assigned the return value.
-
- Return Value: = A - B
-
- See Also: m3_sub m4_div m4_add
-
- --------------------------------------------------------------------------------
- MATRIX
- matrix4 *m4_transpose( matrix4 *A, matrix4 *B)
- Function: Transpose a 4x4 matrix.
-
- Arguments: = 4x4 matrix "B" equals the transpose of the 4x4 matrices "A"
-
- Notes: "B" is assigned the return value.
-
- Return Value: = transpose(A)
-
- See Also: m3_transpose
-
- ================================================================================
- -------------------------------- 2D VECTORS ----------------------------------
-
- vector2 *v2_add( vector2 *u, vector2 *v, vector2 *w )
- Function: Add two 2D vectors.
-
- Arguments: = 2D vector "w" equals 2D vectors "u" + "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u + v
-
- See Also: v3_add
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_combine( vector2 *u, double c1,
- vector2 *v, double c2, vector2 *w )
- Function: Return the linear combination of two 2D vectors.
-
- Arguments: = 2D vector "w" equals scalar constant "c1" * 2D vector "u"
- + scalar constant "c2" * 2D vector "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = c1(u) + c2(v)
-
- See Also: v3_combine
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_copy( vector2 *v )
- Function: Make a copy of a 2D vector.
-
- Arguments: = a copy is made of the 2D vector "v"
-
- Return Value: = copy of 2D vector "v"
-
- See Also: v2_new v3_copy
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- double v2_dot( vector2 *u, vector2 *v )
- Function: Return the dot product of two 2D vectors.
-
- Arguments: = 2D vector "w" equals 2D vectors "u" dot "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u dot v
-
- See Also: v3_dot
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- double v2_len( vector2 *v )
- Function: Return the magnitude (length) of a 2D vector.
-
- Arguments: = length of the 2D vector "v" is returned
-
- Return Value: = length of v
-
- See Also: v3_len
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- double v2_len_sqr( vector2 *v )
- Function: Return the magnitude of a 2D vector squared (squared length).
-
- Arguments: = use 2D vector "v"
-
- Return Value: = squared length of "v"
-
- See Also: v3_len_sqr
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_lerp( vector2 *lo, vector2 *hi, double alpha, vector2 *w )
- Function: Linearly interpolate between two 2D vectors by some amount.
-
- Arguments: = 2D vector "w" equals linear interpolation between two 2D vectors
- "lo" and "hi" by amount "alpha"
-
- Notes: When "alpha" = 0, "w" = "lo". When "alpha" = 1, "w" = "hi".
-
- Return Value: = linear interpolation between lo and hi by alpha
-
- See Also: v3_lerp
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_mul( vector2 *u, vector2 *v, vector2 *w )
- Function: Multiply two 2D vectors component-wise.
-
- Arguments: = 2D vector "w" equals 2D vectors "u" * "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u * v
-
- See Also: v3_mul
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- Point2 *v2_mul_by_proj( Point2 *p, matrix3 *A, Point2 *q )
- Function: Multiply a point by a projection matrix and return the transformed
- point.
-
- Arguments: = 2D point "q" equals 2D point "p" * projection matrix "A"
-
- Notes: "q" is assigned the return value.
-
- Return Value: = p * A
-
- See Also: v3_mul_by_proj
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_neg( vector2 *v )
- Function: Negate a 2D vector.
-
- Arguments: = 2D vector "v" is negated
-
- Notes: "v" is assigned the return value.
-
- Return Value: = -v
-
- See Also: v3_neg
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_new( double x, double y )
- Function: Create and initialize a new 2D vector.
-
- Arguments: = new 2D vector initialized to ("x","y")
-
- Return Value: = new 2D vector
-
- See Also: v2_copy v3_new
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_norm( vector2 *v )
- Function: Normalize a 2D vector (becomes unit length).
-
- Arguments: = 2D vector "v" is normalized.
-
- Notes: "v" is assigned the return value.
-
- Return Value: = normal v
-
- See Also: v3_norm
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_ortho( vector2 *u, vector2 *v )
- Function: Return some orthogonal (perpendicular) 2D vector to a 2D vector.
-
- Arguments: = 2D vector "v" equals some orthogonal vector to 2D vectur "u"
-
- Notes: "v" is assigned the return value.
-
- Return Value: = some orthogonal vector to "u"
-
- See Also: v3_ortho
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_scale( vector2 *v, double newlen )
- Function: Scale a 2D vector to some new length.
-
- Arguments: = 2D vector "v" is scaled to length "newlen"
-
- Notes: "v" is assigned the return value.
-
- Return Value: = v scaled to length newlen
-
- See Also: v3_scale
- --------------------------------------------------------------------------------
- 2D VECTORS
- double v2_seg_len( Point2 *p, Point2 *q )
- Function: Return the distance between two 2D points (length of line segment).
-
- Arguments: = 2D points "p" and "q" form endpoints line segment
-
- Return Value: = length of line segment pq
-
- See Also: v3_segment_length
-
- --------------------------------------------------------------------------------
- 2D VECTORS
- vector2 *v2_sub( vector2 *u, vector2 *v, vector2 *w )
- Function: Subtract two 2D vectors.
-
- Arguments: = 2D vector "w" equals 2D vectors "u" - "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u - v
-
- See Also: v3_sub
-
- ================================================================================
- -------------------------------- 3D VECTORS ----------------------------------
-
- vector3 *v3_add( vector3 *u, vector3 *v, vector3 *w )
- Function: Add two 3D vectors.
-
- Arguments: = 3D vector "w" equals 3D vectors "u" + "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u + v
-
- See Also: v2_add
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_combine( vector3 *u, double c1,
- vector3 *v, double c3, vector3 *w )
- Function: Return the linear combination of two 3D vectors.
-
- Arguments: = 3D vector "w" equals scalar constant "c1" * 3D vector "u"
- + scalar constant "c3" * 3D vector "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = c1(u) + c3(v)
-
- See Also: v2_combine
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_copy( vector3 *v )
- Function: Make a copy of a 3D vector.
-
- Arguments: = a copy is made of the 3D vector "v"
-
- Return Value: = copy of 3D vector "v"
-
- See Also: v2_copy v3_new
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- double v3_dot( vector3 *u, vector3 *v )
- Function: Return the dot product of two 3D vectors.
-
- Arguments: = 3D vector "w" equals 3D vectors "u" dot "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u dot v
-
- See Also: v2_dot
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- double v3_len( vector3 *v )
- Function: Return the magnitude (length) of a 3D vector.
-
- Arguments: = length of the 3D vector "v" is returned
-
- Return Value: = length of v
-
- See Also: v2_len
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- double v3_len_sqr( vector3 *v )
- Function: Return the magnitude of a 3D vector squared (squared length).
-
- Arguments: = use 3D vector "v"
-
- Return Value: = squared length of "v"
-
- See Also: v2_len_sqr
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_lerp( vector3 *lo, vector3 *hi, double alpha, vector3 *w )
- Function: Linearly interpolate between two 3D vectors by some amount.
-
- Arguments: = 3D vector "w" equals linear interpolation between two 3D vectors
- "lo" and "hi" by amount "alpha"
-
- Notes: When "alpha" = 0, "w" = "lo". When "alpha" = 1, "w" = "hi".
-
- Return Value: = linear interpolation between lo and hi by alpha
-
- See Also: v2_lerp
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_mul( vector3 *u, vector3 *v, vector3 *w )
- Function: Multiply two 3D vectors component-wise.
-
- Arguments: = 3D vector "w" equals 3D vectors "u" * "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u * v
-
- See Also: v2_mul v3_mul_by_proj
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- Point3 *v3_mul_by_proj( Point3 *p, matrix3 *A, Point3 *q )
- Function: Multiply a point by a projection matrix and return the transformed
- point.
-
- Arguments: = 3D point "q" equals 3D point "p" * projection matrix "A"
-
- Notes: "q" is assigned the return value.
-
- Return Value: = p * A
-
- See Also: v2_mul_by_proj v3_mul_by_matrix
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- Point3 *v3_mul_by_matrix( Point3 *p, matrix3 *A, Point3 *q )
- Function: Multiply a point by a matrix and return the transformed point.
-
- Arguments: = 3D point "q" equals 3D point "p" * matrix "A"
-
- Notes: "q" is assigned the return value.
-
- Return Value: = p * A
-
- See Also: v3_mul_by_proj
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_neg( vector3 *v )
- Function: Negate a 3D vector.
-
- Arguments: = 3D vector "v" is negated
-
- Notes: "v" is assigned the return value.
-
- Return Value: = -v
-
- See Also: v2_neg
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_new( double x, double y )
- Function: Create and initialize a new 3D vector.
-
- Arguments: = new 3D vector initialized to ("x","y")
-
- Return Value: = new 3D vector
-
- See Also: v2_new v3_copy
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_norm( vector3 *v )
- Function: Normalize a 3D vector (becomes unit length).
-
- Arguments: = 3D vector "v" is normalized.
-
- Notes: "v" is assigned the return value.
-
- Return Value: = normal v
-
- See Also: v2_norm
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_ortho( vector3 *u, vector3 *v )
- Function: Return some orthogonal (perpendicular) 3D vector to a 3D vector.
-
- Arguments: = 3D vector "v" equals some orthogonal vector to 3D vectur "u"
-
- Notes: "v" is assigned the return value.
-
- Return Value: = some orthogonal vector to "u"
-
- See Also: v2_ortho
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_scale( vector3 *v, double newlen )
- Function: Scale a 3D vector to some new length.
-
- Arguments: = 3D vector "v" is scaled to length "newlen"
-
- Notes: "v" is assigned the return value.
-
- Return Value: = v scaled to length newlen
-
- See Also: v2_scale
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- double v3_seg_len( Point3 *p, Point3 *q )
- Function: Return the distance between two 3D points (length of line segment).
-
- Arguments: = 3D points "p" and "q" form endpoints line segment
-
- Return Value: = length of line segment pq
-
- See Also: v2_segment_length
-
- --------------------------------------------------------------------------------
- 3D VECTORS
- vector3 *v3_sub( vector3 *u, vector3 *v, vector3 *w )
- Function: Subtract two 3D vectors.
-
- Arguments: = 3D vector "w" equals 3D vectors "u" - "v"
-
- Notes: "w" is assigned the return value.
-
- Return Value: = u - v
-
- See Also: v2_sub
-
- ================================================================================
-
-
- =============================---------------------==============================
- ------------------------------- MISCELLANEOUS --------------------------------
- ---------------------
- void beep(void);
- Function: Beep the internal speaker.
-
- Notes: This procedure is useful for signifying an error by the user or to
- attract the user's attention.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- byte bestlib_init(byte mode, boolean mouse);
- Function: Initialize THE BEST LIBRARY and set default values.
-
- Arguments: = will change to video mode "mode"
- - FALSE does not change the video mode
- - [value] any number that represents a video mode
- - TEXT change to a text mode if not already in one
- - TEXT25 change to 25-line color or monochrome mode (depending
- on the display adapter installed) if not already in it
- - TEXT50 change to 50-line color mode if not already in it
- - TEXT25F change to 25-line color or monochrome mode (depending
- on the display adapter installed) regardless of whether
- or not already in it
- - TEXT50F change to 50-line color mode regardless of whether or
- not already in it
- - VGA16 change to 640x480 16 color graphics mode
- - VGA256 change to 320x200 256 color graphics mode
- = if "mouse" equals
- - TRUE - initializes mouse to video mode "mode" (if "mode" =
- FALSE, initializes to current video mode) by a call to
- "ms_init"
- - FALSE - does not initialize mouse
-
- Notes: "bestlib_init" sets up necessary default internal values; run it before
- using any functions from THE BEST LIBRARY. The following default
- global variables are initialized:
- blink = TRUE
- txt_cur_move = TRUE
- If "bestlib_init" is called from a text mode, it fills the structure
- "cursor" and saves the text video memory by a call to
- "txt_mem(TEXTSAVE, NULL)". The delay counter is initialized to the
- speed of the computer by a call to "msec".
-
- Return Value: = previous video mode if the video mode was changed (if not
- changed, then "bestlib_init" returns the current video mode)
-
- See Also: _video_set
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- void boot(word how);
- Function: Either warm or cold boot the system.
-
- Arguments: = will boot the computer according to "how":
- - WARM warm boot the system
- - COLD cold boot the system
-
- Notes: A warm boot is the same as pressing Ctrl-Alt-Del -- a cold boot is the
- same as pressing the reset button. WARNING a cold boot should not be
- performed unless all disk activity has completed (this includes disk
- caching).
-
- Return Value: None.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- char *dos_shell(void);
- Function: Shell to DOS, returning upon the user typing "EXIT".
-
- Notes: Performs an exhaustive search for the file COMMAND.COM, searching first
- for COMSPEC= in the DOS environment string and the entire PATH. If not
- found, "dos_shell" searches the current path, C:\, C:\DOS, and finally
- C:\BIN. If COMMAND.COM is still not found, "dos_shell" aborts and
- returns the fifth error message (of the messages displayed below) to the
- calling program.
-
- The program screen is not restored upon the user typing "EXIT", this is
- the program's responsibility. The video mode, however, is restored.
-
- Return Value: = NULL if successful
- = a pointer to the error message if unsuccessful
- - possible error messages:
- - Bad argument passed to COMMAND.COM
- - Too many arguments passed to COMMAND.COM
- - Internal error -- exitting to DOS is strongly recommended
- - Out of memory -- cannot shell to DOS
- - Cannot find file COMMAND.COM -- initialize COMSPEC=[path]COMMAND.COM
-
- Example Program: Prints up a simple menu system. The first and second menu
- EXAMP001.EXE options have no real function, as this is just an example.
- It waits for the user to select an option and, unless the
- exit option was selected, will prompt the user for another
- selection.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- void msec(int delaytime);
- Function: Delay the computer for a specific number of milliseconds.
-
- Arguments: = delays the computer for "delaytime" milliseconds
- (1000 milliseconds = 1 second)
-
- Notes: This procedure is CPU-independent, meaning it will delay for one
- millisecond on a dinosaur 4.77mhz 8088 machine and a super-power 100mhz
- 586/pentium machine. The first call to this function initializes itself
- to the specific computer.
-
- See Also: stopw
-
- Example Program: This program animates some text around the screen, performing
- EXAMP003.EXE a pause between each move using the procedure msec.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- void sound_off(void);
- Function: Stop any sound coming from the speaker.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- boolean stopw(byte index, word delaytime);
- Function: Initialize a stopwatch to a specific clock-tick delay.
-
- Arguments: = "index" refers to a stopwatch (a unique "index" for each stopwatch)
- - must be between 0 and 99 inclusive
- = the stopwatch will be set to count down from "delaytime" clock
- ticks (1 clock tick = 55 milliseconds, 1 second = 18.2 clock ticks)
- - if "delaytime" = FALSE, will read the state of stopwatch "index"
-
- Notes: This procedure is CPU-independent, meaning it will delay for one clock
- tick on a dinosaur 4.77mhz 8088 machine and a super-power 100mhz 80586
- machine. The first call to this function initializes itself to the
- specific computer. It is very useful if you do not wish your program
- to stop everything and wait for a period of time. Instead of returning
- control when the desired delay time has expired, as the procedure msec
- does, control is returned immediately. The only disadvantage of stopw
- is the minimum delay is 55 milliseconds, or 55 thousandths of a second
- (msec has a minimum delay of one millisecond, or one thousandth of a
- second).
-
- Return Value: = if "delaytime" is FALSE will return
- - TRUE if stopwatch "index" is finished
- - FALSE if stopwatch "index" is not finished
- See Also: msec
-
- Example Program: This program sets a random delay for each rock to stay
- EXAMP004.EXE stationary using the stopw function. When this delay has
- expired, the rock is moved and a new random delay is set.
-
- --------------------------------------------------------------------------------
- MISCELLANEOUS
- byte video_get(void);
- Function: Read the current state of the video adapter.
-
- void video_set(byte mode);
- Function: Change the video mode.
-
- Arguments: = video_set - "mode" represents the video mode to change to
- - [value] any number that represents a video mode
- - TEXT change to a text mode if not already in one
- - TEXT25 change to 25-line color or monochrome mode
- (depending on the display adapter
- installed) if not already in it
- - TEXT50 change to 50-line color mode if not already
- in it
- - TEXT25F change to 25-line color or monochrome mode
- (depending on the display adapter
- installed) regardless of whether or not
- already in it
- - TEXT50F change to 50-line color mode regardless of
- whether or not already in it
- - VGA16 change to 640x480 16 color graphics mode
- - VGA256 change to 320x200 256 color graphics mode
-
- Notes: Both functions call the ROM-BIOS to get/set the video mode. If already
- in a text mode and "mode" equals TEXT25F or TEXT50F, the text video
- memory is cleared to a BLACK background and LIGHTGREY foreground by the
- ROM-BIOS. "video_set" will reset the active and visual video page to
- 0. NOTE you must re-initialize to mouse with a call to "ms_init" to
- the new video mode. Do not input random values for "mode" in
- "video_set" because some monitors and video cards are susceptible to
- permanent damage if forced into a mode they were not designed for.
-
- Return Value: = video_get - current video mode (same as the "mode"s, used in
- video_set, except TEXT25F/TEXT50F are returned as
- TEXT25/TEXT50 respectively)
-
- See Also: bestlib_init txt_mem txt_rows
-
- Example Program:
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- int oldmode;
-
- bestlib_init(TEXT25); /* initialize THE BEST LIBRARY */
- oldmode = video_get(); /* save the old video mode */
-
- /* the actual program code would go here... */
-
- video_set(oldmode); /* restore the original video mode */
- exit(0); /* exit to DOS with errorlevel 0 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- ================================================================================
-
-
- =================================-------------==================================
- ----------------------------------- MOUSE ------------------------------------
- -------------
-
- void ms_get(int *x, int *y);
- Function: Store the location of the mouse cursor.
-
- int ms_getx(void);
- Function: Return the mouse cursor abscissa.
-
- int ms_gety(void);
- Function: Return the mouse cursor ordinate.
-
- Arguments: = ms_get - stores mouse cursor abscissa into "x" and mouse cursor
- ordinate into "y"
- - if mouse is in text mode, assumes (byte *x, byte *y)
- - if "y" is NULL, "x" is assumed to be "int *xy" (or
- byte *xy if mouse is in text mode), a data structure
- that has "x" and "y" as consecutive integers/bytes
-
- Notes: ms_getx and ms_gety return byte value if the mouse cursor was
- initialized in text mode.
-
- Return Value: = ms_getx - abscissa of mouse cursor
- = ms_gety - ordinate of mouse cursor
-
- See Also: cur_get ms_set ms_setx ms_sety
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_hide(void);
- Function: Hide the mouse cursor.
-
- Notes: This procedure works in text and graphics mode. Always hide the mouse
- cursor in graphics mode before performing any update to the screen.
- The mouse cursor does not have to be hidden during a text mode update
- if that update does not modify the attribute of a character.
-
- See Also: ms_show
-
- --------------------------------------------------------------------------------
- MOUSE
- boolean ms_init(byte mode);
- Function: Initialize the mouse driver.
-
- Arguments: = "mode" determines the video mode the mouse will operate in:
- - [value] any number that represents a video mode
- - TEXT25 25-line text mode
- - TEXT50 50-line text mode
- - VGA16 640x480 16 color graphics mode
- - VGA256 320x200 256 color graphics mode
-
- Notes: The global variable "mousepresent" is set to the return value. The
- mouse cursor is centered on the screen (coordinates are stored in
- "mousedata.npos[0]","mousedata.npos[1]") and is hidden (use ms_show to
- display the cursor). The movement range of the mouse cursor is set to
- the screen dimensions. See Global Type Definitions for a description
- of the structure "mousedata".
-
- Return Value: = TRUE if mouse driver is detected and initialized
- = FALSE if mouse driver is not detected
-
- See Also: video_set
-
- --------------------------------------------------------------------------------
- MOUSE
- boolean ms_kill(void);
- Function: Completely disable the mouse driver so that it must be reloaded to
- be used again.
-
- Notes: It is rarely to use this procedure. It is included if the need arises.
-
- Return Value: = TRUE if successful
- = FALSE if failed
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_range(int minx, int miny, int maxx, int maxy);
- Function: Set the mouse cursor's minimum and maximum range of movement.
-
- Arguments: = minimum x-range is set to "minx" and the maximum to "maxx"
- - if "minx" = MIN, minimum abscissa is set to the screen minimum
- - if "maxx" = MAX, maximum abscissa is set to the screen maximum
- = minimum y-range is set to "miny" and the maximum to "maxy"
- - if "miny" = MIN, minimum ordinate is set to the screen minimum
- - if "maxy" = MAX, maximum ordinate is set to the screen maximum
-
- Notes: The mouse cursor will not move beyond the set range.
- +----------------+--------+--------+-------+--------+
- | | TEXT25 | TEXT50 | VGA16 | VGA256 |
- +----------------+--------+--------+-------+--------+
- | movement range | 0-79 | 0-79 | 0-639 | 0-319 |
- | movement range | 0-24 | 0-49 | 0-479 | 0-199 |
- +----------------+--------+--------+-------+--------+
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_set(int x, int y);
- Function: Set the mouse cursor's abscissa and ordinate.
-
- int ms_setx(int x);
- Function: Set the mouse cursor's abscissa.
-
- int ms_sety(int y);
- Function: Set the mouse cursor's ordinate.
-
- Arguments: = ms_set - sets mouse abscissa,ordinate to "x","y"
- ms_setx - sets mouse abscissa to "x"
- ms_sety - sets mouse ordinate to "y"
- = if "x" = MEM, "mousedata.npos[0]" is used
- = if "y" = MEM, "mousedata.npos[1]" is used
-
- Notes: If values are supplied for either "x" or "y", they are stored into
- "mousedata.npos[0]" or "mousedata.npos[1]", respectively. See Global
- Type Definitions for a description of the structure "mousedata".
-
- Return Value: = ms_setx - mouse ordinate
- = ms_sety - mouse abscissa
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_shape(byte fgclr, byte bgclr, char ch);
- Function: Change the mouse character.
-
- Arguments: = the mouse cursor is changed to the ASCII code "ch"
- = the foreground color of the mouse cursor becomes "fgclr"
- - if "fgclr" = NO, the foreground color is XORed (ie. a white
- foreground would result in a black-foreground mouse cursor).
- = the background color of the mouse cursor becomes "bgclr"
- - if "bgclr" = NO, the background color is XORed (ie. a black
- background would result in a white-background mouse cursor).
-
- Notes: This procedure changes the ASCII code that represents the mouse cursor
- and works only in text mode.
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_show(void);
- Function: Display the mouse cursor.
-
- Notes: "ms_show" cancels one "ms_hide"; for every "ms_hide" called, an
- "ms_show" must be called (ie. if "ms_hide" was called three times in
- a row, to display the mouse cursor, "ms_show" must be called three
- times in a row).
-
- See Also: ms_hide
-
- --------------------------------------------------------------------------------
- MOUSE
- void ms_stat(void);
- Function: Store detailed information about the mouse's status.
-
- Notes: Updates the button status and mouse cursor position information in
- "msdata.nbuts" and "msdata.npos", respectively.
-
- ================================================================================
-
-
- ================================--------------==================================
- ---------------------------------- STRING ------------------------------------
- --------------
- char case_down(char ch);
- Function: Return the lowercase of a letter.
-
- char case_down_ptr(char *ch);
- Function: Convert a letter to lowercase.
-
- char case_flip(char ch);
- Function: Return the opposite case of a letter.
-
- char case_flip_ptr(char *ch);
- Function: Convert a letter to the opposite case.
-
- char case_up(char ch);
- Function: Return the UPPERCASE of a letter.
-
- char case_up_ptr(char *ch);
- Function: Convert a letter to uppercase.
-
- Arguments: = case_down - the letter "ch" is returned as lowercase
- = case_down_ptr - the letter "ch" is converted to lowercase
- = case_flip - the letter "ch" is returned as the opposite case
- = case_flip_ptr - the letter "ch" is converted to the opposite case
- = case_up - the letter "ch" is returned as UPPERCASE
- = case_up_ptr - the letter "ch" is converted to UPPERCASE
-
- Return Value: = case_down/case_down_ptr - the lowercase of "ch"
- - "ch" if "ch" is not an UPPERCASE letter
- = case_flip/case_flip_ptr - the opposite case of "ch"
- - "ch" if "ch" is not a letter
- = case_up/case_up_ptr - the UPPERCASE of "ch"
- - "ch" if "ch" is not a lowercase letter
-
- See Also: is_case_down is_case_up
-
- Example Program:
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- char ch, ch2 = 'V';
-
- bestlib_init(); /* initialize THE BEST LIBRARY */
- ch = case_up('g'); /* "ch" will equal 'G' */
- ch = case_down(ch2); /* "ch" will equal 'v' */
- ch = case_flip('h'); /* "ch" will equal 'H' */
- case_down_ptr(&ch2); /* "ch2" will equal 'v' */
- case_up_ptr(&ch); /* "ch2" will equal 'V' */
- case_flip_ptr(&ch2); /* "ch2" will equal 'v' */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- boolean is_number_dec(char *str);
- Function: Check if a string is a decimal number.
-
- boolean is_number_hex(char *str);
- Function: Check if a string is a hexadecimal number.
-
- Return Value: = is_digit_dec - TRUE if "ch" is a decimal digit
- - FALSE if "ch" is not a decimal digit
- = is_digit_hex - TRUE if "ch" is a hexadecimal digit
- - FALSE if "ch" is not a hexadecimal digit
- See Also: is_alpha
-
- --------------------------------------------------------------------------------
- STRING
- void mem_copy(void *destination, void *source, word bytes);
- Function: Make a copy of a memory location.
-
- Arguments: = copy "bytes" bytes from "source" into "destination"
-
- See Also: str_copy
-
- --------------------------------------------------------------------------------
- STRING
- word scan_byte(char *start, char compare, word count, boolean direction);
- Function: Search for a one-byte value.
-
- word scan_bytes(char *start, char compare[], word count, boolean direction);
- Function: Search for one of several one-byte values.
-
- Arguments: = searches "count" bytes, starting at address
- "start"
- - if "count" = NULL, searches the length of string
- "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_byte - searches for the one-byte value "compare",
- starting at "start"
- = scan_bytes - searches for any one of the one-byte values
- "compare", starting at "start"
-
- Notes: "scan_bytes": the array must be NULL-terminated. The return value is
- an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first byte value matching "compare"
- = FALSE if no match found
-
- See Also: scan_byte_not scan_str scan_word scan_word_not(Example Program)
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset;
- char *string = "Today is a bright day.";
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_byte(string, 'd', NULL, FORWARD); /* "offset" = 3 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- word scan_byte_not(char *start, char compare, word count, boolean direction);
- Function: Search for any other one-byte value.
-
- word scan_bytes_not(char *start, char compare[],
- word count, boolean direction);
- Function: Search for any other one-byte value.
-
- Arguments: = searches "count" bytes, starting at address
- "start"
- - if "count" = NULL, searches the length of string
- "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_byte_not - searches for any one-byte value other than
- "compare", starting at "start"
- = scan_bytes_not - searches for any one-byte value other than those
- in "compare", starting at "start"
-
- Notes: "scan_bytes_not": the array must be NULL-terminated. The return value
- is an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first byte value not matching "compare"
- = FALSE if only "compare" present
-
- See Also: scan_byte scan_word_not(Example Program)
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset;
- char *string = " Today is a cloudy day.";
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_byte_not(string, ' ', NULL, FORWARD); /* "offset" = 2 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- word scan_str(char *start, char *compare, word count, boolean direction);
- Function: Search for a string of characters.
-
- word scan_strs(char *start, char *compare[], word count, boolean direction);
- Function: Search for any one of several strings of characters.
-
- Arguments: = searches "count" bytes, starting at address
- "start"
- - if "count" = NULL, searches the length of string
- "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_str - searches for the string "compare", starting at
- "start"
- = scan_strs - searches for any one of the strings "compare",
- starting at "start"
-
- Notes: "scan_strs": the array must be NULL-terminated. The return value is
- an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first string matching "compare"
- = FALSE if no match found or
- if either "compare" or "start" are not
- strings
-
- See Also: scan_byte scan_word scan_word_not(Example Program), str_fill_byte
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset;
- char string[] = "Today is a HOT day.";
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_str(start, "is", NULL, FORWARD); /* "offset" = 7 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- word scan_str_not(char *start, char *compare, word count, boolean direction);
- Function: Search for any other string of characters.
-
- word scan_strs_not(char *start, char *compare[],
- word count, boolean direction);
- Function: Search for any other string of characters.
-
- Arguments: = searches "count" bytes, starting at address
- "start"
- - if "count" = NULL, searches the length of string
- "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_str_not - searches for any string other than "compare",
- starting at "start"
- = scan_strs_not - searches for any string other than those in
- "compare", starting at "start"
-
- Notes: "scan_strs_not": the array must be NULL-terminated. The return value
- is an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first string matching "compare"
- = FALSE if no match found or
- if either "compare" or "start" are not
- strings
-
- See Also: scan_byte scan_word scan_word_not(Example Program)
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset;
- char string[] = "Today is a HOT day.";
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_str(string, "is", NULL, FORWARD); /* "offset" = 7 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- word scan_word(word *start, word compare, word count, boolean direction);
- Function: Search for a one-word (two-byte) value.
-
- word scan_words(word *start, word compare[], word count, boolean direction);
- Function: Search for one of several one-word (two-byte) values.
-
- Arguments: = searches "count" bytes, starting at address
- "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_word - searches for the one-word value "compare"
- = scan_words - searches for any one of the one-word values in
- "compare"
-
- Notes: "scan_words": the array must be NULL-terminated. The search is
- performed one word (two bytes) at a time. Therefore, "start"
- should always point to integer-only arrays of data. The return value
- is an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first word-value matching "compare"
- = FALSE if no match found or if "count" = 0
-
- See Also: scan_byte scan_str scan_word_not(Example Program)
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset, numbers[] = { 4, 16, 64, 256, 1024 };
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_word(numbers, 16, 5, FORWARD); /* "offset" = 2 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- word scan_word_not(word *start, word compare, word count, boolean direction);
- Function: Search for any other one-word (two-byte) value.
-
- word scan_words_not(word *start, word compare[],
- word count, boolean direction);
- Function: Search for any other one-word (two-byte) value.
-
- Arguments: = searches for any one-word value other than "compare" for
- "count" bytes, starting at address "start"
- = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = scan_word_not - searches for any one-word value other than
- "compare"
- = scan_words_not - searches for any one-word value other than
- those in "compare"
-
- Notes: "scan_words_not": the array must be NULL-terminated. The search is
- performed one word (two bytes) at a time. Therefore, "start"
- should always point to integer-only arrays of data. The return value
- is an integer offset, not a pointer. Add (or subtract if "direction" =
- BACKWARD) this offset to "start" to derive a pointer to one
- past (or one before if "direction" = BACKWARD) the match (assuming a
- match was found). It is set to one past because if it were set to the
- correct offset, then if a match was found at "start", the
- function would return 0, which means FALSE (no match).
-
- Return Value: = offset + 1 of first word-value not matching "compare"
- = FALSE if only "compare" present
-
- See Also: scan_byte_not scan_word
-
- Example Program:
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include <!bestlib.h> /* include !BESTLIB.H in compilation */
-
- void main(void)
- {
- word offset, numbers[] = { 4, 3, 3, 5, 2, 2, 6, 1, 1 };
-
- bestlib_init(FALSE, FALSE); /* initialize THE BEST LIBRARY */
- offset = scan_word_not(numbers+1, 3, 9, FORWARD); /* "offset" = 3 */
- /* NOTE "offset" is the RELATIVE offset from the beginning of the scan; a
- non-3 number occurs at absolute position 4, but because we started
- our scan from the second number, "offset" = 3 */
- }
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
- --------------------------------------------------------------------------------
- STRING
- int sign(int number);
- Function: Read the sign of a number.
-
- Arguments: = the sign of the number "number" is returned
-
- Return Value: = +1 if the sign of the number "number" is positive
- = 0 if the number "number" is zero
- = -1 if the sign of the number "number" is negative
-
- --------------------------------------------------------------------------------
- STRING
- void str_add(char *str);
- Function: Add to a number stored as an ASCII string.
-
- void str_dec(char *str);
- Function: Decrement a number stored as an ASCII string.
-
- void str_div(char *str);
- Function: Divide a number stored as an ASCII string.
-
- void str_inc(char *str);
- Function: Increment a number stored as an ASCII string.
-
- void str_mul(char *str);
- Function: Multiply a number stored as an ASCII string.
-
- void str_sub(char *str);
- Function: Subtract from a number stored as an ASCII string.
-
- Arguments: = ASCII number "str" is modified
-
- Notes: If the number is its greatest possible, these functions will roll it back
- to zero (ie. strinc("99") would result in "00"). These functions greatly
- simplify the process of mathematically manipulating string numerals.
-
- --------------------------------------------------------------------------------
- STRING
- int str_case_down(char *str);
- Function: Convert all characters in a string to lowercase.
-
- int str_case_down_pr(printdata *prdata);
- Function: Convert all characters in "prdata.string" to lowercase.
-
- int str_case_flip(char *str);
- Function: Convert all characters in a string to the opposite case.
-
- int str_case_flip_pr(printdata *prdata);
- Function: Convert all characters in "prdata.string" to the opposite case.
-
- int str_case_up(char *str);
- Function: Convert all characters in a string to uppercase.
-
- int str_case_up_pr(printdata *prdata);
- Function: Convert all characters in "prdata.string" to uppercase.
-
- Arguments: = str_case_down - convert characters in string "str" to lowercase
- = str_case_down_pr - convert characters in string "prdata.string"
- to lowercase
- = str_case_flip - convert characters in string "str" to the
- opposite case
- = str_case_flip_pr - convert characters in string "prdata.string"
- to the opposite case
- = str_case_up - convert characters in string "str" to
- uppercase
- = str_case_up_pr - convert characters in string "prdata.string"
- to lowercase
- Notes: See Global Type Definitions for a description of the structure
- "printdata".
-
- Return Value: = length of string
-
- --------------------------------------------------------------------------------
- STRING
- int str_cmp(char *str1, char *str2);
- Function: Compare two strings.
-
- Arguments: = compares the string "str1" to the string "str2"
-
- Return Value: = +1 if "str1" is alphabetically greater than "str2"
- = 0 if "str1" and "str2" are the same
- = -1 if "str1" is alphabetically less than "str2"
-
- Example Program: This program prompts the user to enter a password. The
- EXAMP005.EXE user's input is compared to the valid password using the
- str_cmp function.
-
- --------------------------------------------------------------------------------
- STRING
-
- word str_copy(char *destination, char *source);
- Function: Copies a string.
-
- Arguments: = copies string "source" into string "destination"
-
- Notes: The destination does not have to be of type "char":
- int dest[16];
- char *source = "This is a test";
- str_copy((char *)dest, source);
- Remember to use a type cast when "destination" is not of type "char".
-
- Return Value: = length of "source"
-
- See Also: mem_copy
-
- --------------------------------------------------------------------------------
- STRING
- void str_dec(char *str);
-
- [see str_add]
-
- --------------------------------------------------------------------------------
- STRING
- void str_del_byte(char *start, char del, word count);
- Function: Delete all occurrences of a byte from a string.
-
- void str_del_str(char *start, char *del, word count);
- Function: Delete all occurences of a string from a string.
-
- void str_del_word(word *start, word del, word count);
- Function: Delete all occurrences of a word from an array of word-values.
-
- Arguments: = str_del_byte - every occurrence of byte-value "del" is searched
- for, starting from "start", and deleted, scanning
- through "count" bytes
- - if "count" = NULL, searches to the end of string
- "start"
- str_del_str - every occurrence of string "del" is searched for,
- starting from "start", and deleted, scanning
- through "count" bytes
- - if "count" = NULL, searches to the end of string
- "start"
- str_del_word - every occurrence of word-value "del" is searched
- for, starting from "start", and deleted, scanning
- through "count" words
-
- Notes: These functions perform exactly like pressing the Del key in a word
- processor on every occurrence of a value.
-
- See Also: str_del_bytes str_rep_byte_byte
-
- --------------------------------------------------------------------------------
- STRING
- void str_del_bytes(char *start, word count);
- Function: Delete bytes from a string.
-
- void str_del_words(word *start, word count);
- Function: Delete words from an array of word-values.
-
- Arguments: = str_del_bytes - "count" byte-values (ie. characters), starting at
- "start", are deleted
- str_del_words - "count" word-values (ie. integers), beginning at
- "start", are deleted
-
- Notes: These functions perform exactly like pressing the Del key in a word
- processor.
-
- See Also: str_del_byte str_ins_byte
-
- --------------------------------------------------------------------------------
- STRING
- void str_div(char *str);
-
- [see str_add]
-
- --------------------------------------------------------------------------------
- STRING
- void str_fill_byte(char *destination, char source, word count);
- Function: Fill memory with a one-byte value.
-
- void str_fill_str(char *destination, char *source, word count);
- Function: Fill memory with a string of characters.
-
- void str_fill_word(word *destination, word source, word count);
- Function: Fill memory with a one-word (two-byte) value.
-
- Arguments: = "count" sources "source" are written to memory location
- "destination"
-
- Notes: No NULL-terminator is appended to "destination".
-
- See Also: scan_byte
-
- --------------------------------------------------------------------------------
- STRING
- void str_inc(char *str);
-
- [see str_add]
-
- --------------------------------------------------------------------------------
- STRING
- void str_ins_byte(char *start, char insert, word count);
- Function: Insert a one-byte value into a string.
-
- void str_ins_str(char *start, char *insert, word count);
- Function: Insert a string into a string.
-
- void str_ins_word(word *start, word insert, word count);
- Function: Insert a one-word (two byte) value into an array of words.
-
- Arguments: = str_ins_byte - "count" byte-values "insert" are inserted into
- string "start"
- str_ins_str - "count" strings of characters "insert" are
- inserted into string "start"
- str_ins_word - "count" word-values "insert" are inserted into
- the array of word-values "start"
- See Also: str_del_bytes
-
- --------------------------------------------------------------------------------
- STRING
- word str_len(char *str);
- Function: Return the length of a string.
-
- word str_len_pr(printdata *prdata);
- Function: Return the length of "prdata.string".
-
- Arguments: = str_len - the string "str" is counted
- str_len_pr - the string "prdata.string" is counted
-
- Notes: The length of the string returned is a count of the number of letters
- of the entire string, NOT including the NULL terminating character.
- A return value of 0 can mean the string is empty, or that it is not a
- string (no NULL terminator found).
-
- Return Value: = length of the string (number of characters)
-
- --------------------------------------------------------------------------------
- STRING
- void str_mul(char *str);
-
- [see str_add]
-
- --------------------------------------------------------------------------------
- STRING
- char *str_next_str(char *str);
- Function: Return the next string from a string.
-
- char *str_next_word(char *str);
- Function: Return the next word from a string.
-
- Arguments: = "str" - string to read from
-
- Notes: A string can consist of alphanumeric characters, hyphens, apostrophes, or
- text surrounded in quotes, like "It is: 04/12/94" -- nothing else. A
- word can consist of only alphabet letters.
-
- Return Value: = pointer to string read in
- = NULL if there was nothing to get (reached end of string)
-
- --------------------------------------------------------------------------------
- STRING
- void str_rep_byte_byte(char *start, char search,
- char replace, word count, boolean direction);
- Function: Search for all occurrences of a byte and replace it with a different
- byte.
-
- void str_rep_byte_str(char *start, char search,
- char *replace, word count, boolean direction);
- Function: Search for all occurrences of a byte and replace it with a string.
-
- void str_rep_byte_word(char *start, char search,
- word replace, word count, boolean direction);
- Function: Search for all occurrences of a byte and replace it with a word.
-
- Arguments: = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = str_rep_byte_byte - every occurrence of byte "search" is searched
- for, starting from "start", and replaced by
- the byte "replace", scanning through "count"
- "count" bytes
- - if "count" = NULL, searches to the end of
- string "start"
- str_rep_byte_str - every occurrence of byte "search" is searched
- for, starting from "start", and replaced by
- the string "replace", scanning through
- "count" bytes
- - if "count" = NULL, searches to the end of
- string "start"
- str_rep_byte_word - every occurrence of byte "search" is searched
- for, starting from "start", and replaced by
- the word "replace", scanning through "count"
- bytes
-
- Notes: WARNING: IF "count" = NULL AND "direction" = BACKWARD, THESE FUNCTIONS
- WILL SEARCH AND REPLACE BEYOND THE BEGINNING OF STRING "start"
-
- See Also: str_del_byte str_rep_str_byte str_rep_word_byte
-
- --------------------------------------------------------------------------------
- STRING
- void str_rep_str_byte(char *start,
- char *search, char replace, boolean direction);
- Function: Search for all occurrences of a string and replace it with a byte.
-
- void str_rep_str_str(char *start,
- char *search, char *replace, boolean direction);
- Function: Search for all occurrences of a string and replace it with another
- string.
-
- Arguments: = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = if "count" = NULL, searches to the end of string "start"
- = str_rep_str_byte - every occurrence of string "search" is
- searched for, starting from "start", and
- replaced by the byte-value "replace", scanning
- through "count" bytes
- str_rep_str_str - every occurrence of string "search" is
- searched for, starting from "start", and
- replaced by the string "replace", scanning
- through "count" bytes
-
- Notes: WARNING: IF "count" = NULL AND "direction" = BACKWARD, THESE FUNCTIONS
- WILL SEARCH AND REPLACE BEYOND THE BEGINNING OF STRING "start"
-
- See Also: str_rep_byte_byte
-
- --------------------------------------------------------------------------------
- STRING
- void str_rep_word_byte(word *start,
- word search, char replace, boolean direction);
- Function: Search for all occurrences of a word and replace it with a byte.
-
- void str_rep_word_word(word *start,
- word search, word replace, boolean direction);
- Function: Search for all occurrences of a word and replace it with another
- word.
-
- Arguments: = searches in direction "direction"
- - FORWARD - forward direction
- - BACKWARD - reverse direction
- = str_rep_word_byte - every occurrence of word "search" is searched
- for, starting from "start", and replaced by
- the byte "replace", scanning through "count"
- bytes
- str_rep_word_word - every occurrence of word "search" is searched
- for, starting from "start", and replaced by
- the word "replace", scanning through "count"
- bytes
- See Also: str_rep_byte_byte
-
- --------------------------------------------------------------------------------
- STRING
- char str_right(char *str, word number);
- Function: Read one string character, counting from the right.
-
- char str_right_pr(printdata *prdata, word number);
- Function: Read one "prdata.string" character, counting from the right.
-
- Arguments: = str_right - read character number "number" from string "str",
- counting from the right
- str_right_pr - read character number "number from string
- "prdata.string", counting from the right
-
- Notes: "from the right" means from the end of the string.
- char *source = "This is a test";
- ch = str_right(source, 3); /* ch = 'e' */
-
- Return Value: = character "number" from the right of the string
-
- --------------------------------------------------------------------------------
- STRING
- void str_sub(char *str);
-
- [see str_add]
-
- ================================================================================
- --------------------------------- CHARACTER ----------------------------------
-
- boolean is_alpha(char ch);
- Function: Check if a character is an alphabet letter.
-
- boolean is_alpha_down(char ch);
- Function: Check if a character is a lowercase alphabet letter.
-
- boolean is_alpha_up(char ch);
- Function: Check if a character is an uppercase alphabet letter.
-
- boolean is_alphanum(char ch);
- Function: Check if a character is an alphanumeric character.
-
- boolean is_ascii(char ch);
- Function: Check if a character is a standard ASCII character.
-
- boolean is_case_down(char ch);
- Function: Check if a character is a lowercase letter.
-
- boolean is_case_up(char ch);
- Function: Check if a character is an uppercase letter.
-
- boolean is_ctrlchar(char ch);
- Function: Check if a character is a control character (0-31 or 127).
-
- boolean is_digit_dec(char ch);
- Function: Check if a character is a decimal digit.
-
- boolean is_digit_hex(char ch);
- Function: Check if a character is a hexadecimal digit.
-
- boolean is_greek(char ch);
- Function: Check if a character is a greek letter.
-
- boolean is_letter(char ch);
- Function: Check if a character is an alphabet letter, an apostrophe, or a
- hyphen.
-
- boolean is_letternum(char ch);
- Function: Check if a character is an alphanumeric letter, an apostrophe, or a
- hyphen.
-
- boolean is_print(char ch);
- Function: Check if a character is a printable character (has an ASCII symbol).
-
- boolean is_punc(char ch);
- Function: Check if a character is a punctuation character.
-
- Arguments: = character "ch" is checked
-
- Return Value: = is_alpha - TRUE if "ch" is an alphabet letter
- - FALSE if "ch" is not an alphabet letter
- = is_alpha_down - TRUE if "ch" is a lowercase alphabet letter
- - FALSE if "ch" is not a lowercase alphabet letter
- = is_alpha_up - TRUE if "ch" is an uppercase alphabet letter
- - FALSE if "ch" isn't an uppercase alphabet letter
- = is_alphanum - TRUE if "ch" is an alphanumeric character
- - FALSE if "ch" is not an alphanumeric character
- = is_ascii - TRUE if "ch" is a standard ASCII character
- - FALSE if "ch" is not a standard ASCII character
- = is_case_down - TRUE if "ch" is a lowercase letter
- - FALSE if "ch" is not a lowercase letter
- = is_case_up - TRUE if "ch" is an uppercase letter
- - FALSE if "ch" is not an uppercase letter
- = is_ctrlchar - TRUE if "ch" is a control character
- - FALSE if "ch" is not a control character
- = is_digit_dec - TRUE if "ch" is a decimal digit
- - FALSE if "ch" is not a decimal digit
- = is_digit_hex - TRUE if "ch" is a hexadecimal digit
- - FALSE if "ch" is not a hexadecimal digit
- = is_greek - TRUE if "ch" is a greek letter
- - FALSE if "ch" is not a greek letter
- = is_letter - TRUE if "ch" is an alphabet letter, ', or -
- - FALSE if "ch" is not an alphabet letter, ', or -
- = is_print - TRUE if "ch" is a printable character
- - FALSE if "ch" is not a printable character
- = is_punc - TRUE if "ch" is a punctuation character
- - FALSE if "ch" is not a punctuation
-
- Notes: "is_alphanum" and "is_letternum" do not distinguish between decimal and
- hexadecimal number because the hexadecimal numbers are just decimal
- number + alphabet letters
-
- See Also: is_number_dec
-
- ================================================================================
- -------------------------------- CONVERSION ----------------------------------
-
- char *con_bool_to_str(boolean bool);
- Function: Convert a numerical boolean value into its string equivalent.
-
- Arguments: = boolean value "bool" is converted
-
- Return Value: = "TRUE" if "bool" = TRUE
- = "FALSE" if "bool" = FALSE
-
- See Also: con_color_to_str con_str_to_bool
-
- --------------------------------------------------------------------------------
- CONVERSION
- char *con_color_to_str(byte color);
- Function: Convert a numerical color value into its string equivalent.
-
- Arguments: = color value "color" is converted
-
- Return Value: = string representation of color
- = NULL if "color" is not a valid color
-
- See Also: con_bool_to_str con_str_to_color
-
- --------------------------------------------------------------------------------
- CONVERSION
- shortint con_str_to_bool(char *str);
- Function: Convert a boolean word into its numerical equivalent.
-
- Arguments: = "str" - boolean word to convert
-
- Return Value: = TRUE if "str" = "TRUE"
- FALSE if "str" = "FALSE"
- -1 if "str" is not a valid boolean word
-
- See Also: con_bool_to_str con_str_to_color
-
- --------------------------------------------------------------------------------
- CONVERSION
- shortint con_str_to_color(char *str);
- Function: Convert a color name into its numerical equivalent.
-
- Arguments: = "str" - color name to convert
-
- Return Value: = color value
- = -1 if "str" is not a valid color
-
- See Also: con_color_to_str con_str_to_bool
-
- ================================================================================
-
-
- =================================------------===================================
- ----------------------------------- TEXT -------------------------------------
- ------------
- void txt_ascii_get(word number, byte codes[]);
- Function: Read in ASCII character patterns.
-
- Arguments: = reads "number" character patterns into "codes"
-
- Notes: See ASCII GRAPHIC DEFINITIONS for details on the internal structure of
- "codes".
-
- See Also: txt_asc_set
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_ascii_set(word number, byte codes[]);
- Function: Redefine ASCII character patterns to allow for new characters.
-
- Arguments: = sets "number" character patterns using data from "codes"
-
- Notes: See ASCII GRAPHIC DEFINITIONS for details on the internal structure of
- "codes".
-
- See Also: txt_asc_get
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_blink(int what);
- Function: Set 16 background colors or blinking characters.
-
- Arguments: = if "what" = TRUE, blinking characters are set
- = FALSE, 16 background colors are set
-
- --------------------------------------------------------------------------------
- TEXT
- byte txt_char_height(void);
- Function: Return the height of text mode characters (in pixels/scan lines).
-
- byte txt_char_length(void);
- Function: Return the length of text mode characters (in pixels).
-
- Notes: Scan lines are synonymous with pixels counted vertically.
-
- Return Value: = txt_char_height - height of text mode characters (in pixels)
- = txt_char_length - length of text mode characters (in pixels)
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_cls(void);
- Function: Clear the screen.
-
- See Also: txt_flood
-
- --------------------------------------------------------------------------------
- TEXT
- byte txt_erase(byte x, byte y, byte length, byte height);
- Function: Overwrite a region with spaces.
-
- Arguments: = the region with a corner at "x","y", an x-length "length", and a
- y-height "height" is overwritten with spaces (ASCII 32)
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_erase txt_chrs_erase txt_erase_col txt_str_erase
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_erase_col(byte col);
- Function: Overwrite one column of characters with spaces.
-
- void txt_erase_row(byte col);
- Function: Overwrite one row of characters with spaces.
-
- Arguments: = txt_erase_col - column "col" is overwritten with spaces
- = txt_erase_row - column "row" is overwritten with spaces
-
- See Also: txt_erase
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_fill_area(byte x, byte y, filldata *fidata);
- Function: Fill a screen region according to the structure "fidata".
-
- Arguments: = the information in the "filldata" structure "fidata" is used
- = the filling begins at the corner "x","y"
- - if "x" = MEM, "fidata.x" is used
- - if "y" = MEM, "fidata.y" is used
-
- Notes: See Global Type Definitions for a description of the structure
- "filldata".
-
- See Also: txt_attrs_fill txt_chrattrs_fill txt_chrs_fill txt_fill_col
- txt_fill_row txt_flood txt_print
-
- --------------------------------------------------------------------------------
- TEXT
- char txt_fill_col(byte col, byte fgclr, byte bgclr, char *str);
- Function: Fill a column with a string in a defined color.
-
- Arguments: = string "str" is printed in foreground color "fgclr" and
- background color "bgclr" at "col",0 down the screen
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
- - if "str" = NULL, no string is printed
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_attr_show txt_fill_area txt_fill_row
-
- --------------------------------------------------------------------------------
- TEXT
- char txt_fill_row(byte row, byte fgclr, byte bgclr, char *str);
- Function: Fill a row with a string in a defined color.
-
- Arguments: = string "str" is printed in foreground color "fgclr" and
- background color "bgclr" at 0,"row" across the screen
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
- - if "str" = NULL, no string is printed
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_attr_show txt_fill_area txt_fill_col
-
- --------------------------------------------------------------------------------
- TEXT
- word txt_flood(byte fgclr, byte bgclr, char *str);
- Function: Flood the screen with a character in a foreground/background color.
-
- Arguments: = screen is flooded with string "str" -- if "str" = NULL, no string
- is used to fill the screen
- = the foreground color is set to "fgclr" -- if "fgclr" = NO, the
- foreground color is not modified
- = the background color is set to "bgclr" -- if "bgclr" = NO, the
- background color is not modified
-
- Notes: To clear the screen, use the string " " (with a space), ASCII code 32.
-
- Return Value: = length of "str"
-
- See Also: txt_cls txt_fill_area
-
- --------------------------------------------------------------------------------
- TEXT
- word txt_get_abs(void);
- Function: Return the offset of the text page.
-
- Notes: When strictly dealing with whole text pages, use "txt_get_act" and
- "txt_get_vis".
-
- Return Value: = offset of text page
-
- See Also: txt_get_act txt_set_abs
-
- --------------------------------------------------------------------------------
- TEXT
- byte txt_get_act(void);
- Function: Return the current active text video page.
-
- byte txt_get_vis(void);
- Function: Return the current visual text video page.
-
- Notes: The pages are number from TEXTPAGE1 to TEXTPAGE8 for 25 line text modes
- and from TEXTPAGE1 to TEXTPAGE4 for 50 line text modes.
-
- Return Value: = txt_get_act - current active text page
- = txt_get_vis - current visual text page
-
- See Also: txt_get_abs txt_set_act
-
- --------------------------------------------------------------------------------
- TEXT
- byte txt_last(void);
- Function: Return last text page.
-
- Return Value: = last text video page number (starting from 0)
-
- See Also: txt_rows
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_mem(byte what, textimagedata *timage);
- Function: Store or restore the text video memory.
-
- Arguments: = "what"
- - TEXTSHOW restores the text video memory into "timage"
- - TEXTSAVE stores the text video memory into "timage"
- = the storage area "timage" is used
- - if "timage" = NULL, the one built-in storage area is used
-
- Notes: The built-in storage area will hold the contents of an entire 80x50
- screen. The memory requirements of "timage" are returned by the function
- "txt_chrattrs_need(80, height)", using the desired screen "height". This
- function is useful for restoring the screen contents after exitting a
- program to give the user the feel he never left DOS. See Global Type
- Definitions for a description of the structure "textimagedata".
-
- See Also: _video_set
-
- --------------------------------------------------------------------------------
- TEXT
- word txt_print(byte x, byte y, printdata *prdata);
- Function: Print the string "prdata.string" to the text screen.
-
- Arguments: = the information in the "printdata" structure "prdata" is used
- = the printing begins at the corner "x","y"
- - if "x" = MEM, "prdata.x" is used
- - if "y" = MEM, "prdata.y" is used
-
- Notes: If "prdata.x" and "prdata.y" (or "x" and "y") both equal TCUR,
- "txt_print" advances the text cursor position to one past the last
- character printed.
-
- Return Value: = length of "prdata.string"
-
- See Also: txt_fill_area txt_attr_show txt_attrs_show txt_chr_show
- txt_str_show txt_strattr_show txt_str_erase_pr
-
- --------------------------------------------------------------------------------
- TEXT
- byte txt_rows(void);
- Function: Return the [number of rows per page]-1.
-
- Notes: To set the number of rows per page, use "video_set".
-
- Return Value: = [number of rows per page]-1
-
- See Also: txt_last video_set
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_scroll(int columns, int rows);
- Function: Smoothly scroll, in any direction, the entire screen.
-
- void txt_scroll_fast(shortint columns, shortint rows);
- Function: Quickly smoothly scroll, in any direction, the entire screen.
-
- Arguments: = smoothly scrolls the entire screen "columns" columns and "rows"
- rows
-
- Notes: The reason "txt_scroll" is faster is because it does not properly
- align itself with the monitor's vertical retrace periods -- this
- translates to possible flicker. Positive "columns" scrolls right whereas
- negative scrolls left. Positive "rows" scrolls down whereas negative
- scrolls up.
-
- See Also: txt_scroll_off txt_scroll_over txt_scroll_rows txt_scroll_window
- txt_split
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_scroll_off(shortint direction);
- Function: Smoothly scroll the screen off in a direction.
-
- void txt_scroll_on(shortint direction);
- Function: Smoothly scroll a screen on in a direction.
-
- Arguments: = scrolls the screen in direction "direction"
- - UP - scrolls screen up
- - LEFT - scrolls screen left
- - RIGHT - scrolls screen right
- - DOWN - scrolls screen down
-
- Notes: This is a nice effect for entering and exiting programs.
-
- See Also: txt_scroll
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_scroll_over(int scanlines);
- Function: Smoothly scroll a screen overtop another screen.
-
- Arguments: = if "scanlines" is negative, scrolls screen down
- - use negative values to scroll a screen off that was scrolled on
-
- Notes: This is a nice effect for, perhaps, pulling up a help screen.
-
- See Also: txt_scroll
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_scroll_rows(byte row, byte height, shortint horz_scroll);
- Function: Smoothly scroll certain rows.
-
- Arguments: = scrolls the screen region beginning at row "row" with height
- "height" "horz_scroll" columns
-
- Notes: This differs from "txt_scroll" in that only a portion of the screen is
- scrolled, not the entire screen.
-
- See Also: txt_scroll
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_scroll_window(byte x, byte y, byte length, byte height,
- shortint horz_scroll, shortint vert_scroll);
- Function: Smoothly scroll, in any direction, a window of the screen.
-
- Arguments: = scrolls the screen region with a corner at "x","y", an x-length
- "length", and a y-height "height" "horz_scroll" characters and
- "vert_scroll" rows
-
- Notes: Positive "horz_scroll" scrolls right whereas negative scrolls left.
- Positive "vert_scroll" scrolls down whereas negative scrolls up.
-
- See Also: txt_scroll txt_split
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_set_abs(word offset);
- Function: Set the absolute offset of the text page.
-
- void txt_set_rel(int columns, int rows);
- Function: Set the absolute offset of the text page.
-
- Arguments: = txt_set_abs - sets offset of text page to "offset"
- = txt_set_rel - sets horizontal offset "columns" and vertical offset
- "rows" from original offset
-
- Notes: The mouse cursor and text cursor position and shape are not preserved as
- they are by "txt_set_act" and "txt_set_vis" -- when strictly dealing with
- whole text pages, use "txt_set_act" and "txt_set_vis".
-
- See Also: txt_get_abs txt_set_act
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_set_act(byte page);
- Function: Set a text video page as active.
-
- void txt_set_vis(byte page);
- Function: Set a text video page as visual, or seen.
-
- Arguments: = txt_set_act - the active text page "page" is set
- - if "page" = TEXTPAGEVISUAL, the active text page
- becomes the current visual text page
- - if "page" = TEXTPAGELAST, the last page becomes the
- active text page
- = txt_set_vis - the visual text page "page" is set
- - if "page" = TEXTPAGEACTIVE, the visual text page
- becomes the current active text page
- - if "page" = TEXTPAGELAST, the last page becomes the
- visual text page
-
- Notes: The pages are number from TEXTPAGE1 to TEXTPAGE8 for 25 line text modes
- and from TEXTPAGE1 to TEXTPAGE4 for 50 line text modes.
-
- See Also: txt_get_act txt_set_abs
-
- --------------------------------------------------------------------------------
- TEXT
- void txt_split(word line);
- Function: Split the visual screen into two.
-
- Arguments: = the visual page is split at line "line"
-
- Notes: In VGA, the lines range from 0-400 and each character is 16 lines high.
- To break off at an even number of rows, use this formula: (row*16) - 1
- (ie. to split the screen at row 3, use the value 47 for "line"). It is
- possible to display TWO blinking cursors this way.
-
- See Also: txt_scroll txt_scroll_window
-
- ================================================================================
- --------------------------------- ANIMATION ----------------------------------
-
-
- ================================================================================
- --------------------------------- ATTRIBUTE ----------------------------------
-
- char txt_attr_save(byte x, byte y, byte *fgclr, byte *bgclr);
- Function: Read one attribute.
-
- Arguments: = stores the foreground color at "x","y" into "fgclr" and the
- background color into "bgclr"
- - if "fgclr" = NULL, the foreground color is not stored
- - if "bgclr" = NULL, the background color is not stored
-
- Return Value: = ASCII value of the character at "x","y"
-
- See Also: txt_attr_show txt_attrs_save txt_chr_attr_save txt_chrattr_save
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- char txt_attr_show(byte x, byte y, byte fgclr, byte bgclr, int count);
- Function: Print a specific number of one attribute.
-
- Arguments: = prints the foreground color "fgclr" and the background color
- "bgclr" at "x","y"
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
-
- Notes: If "x" and "y" both equal TCUR, "txt_attr_show" advances the text
- cursor position to one past the last attribute printed.
-
- Return Value: = ASCII value of the character at "x","y"
-
- See Also: txt_attr_save txt_attrs_show txt_bg_get txt_chr_show txt_fg_get
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- void txt_attrs_fill(byte x, byte y,
- byte length, byte height, byte fgclr, byte bgclr);
- Function: Fill a screen region with a foreground and/or background color.
-
- Arguments: = the region with a corner at "x","y", an x-length "length", and a
- y-height "height" is filled in foreground "fgclr" and background
- "bgclr"
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
-
- See Also: txt_fill_area
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- word txt_attrs_need(byte length, byte height);
- Function: Return the memory requirement for a "txt_attrs_save"ed image.
-
- word txt_chrattrs_need(byte length, byte height);
- Function: Return the memory requirement for a "txt_chrattrs_save"ed image.
-
- word txt_chrs_need(byte length, byte height);
- Function: Return the memory requirement for a "txt_chrs_save"ed image.
-
- word txt_strattr_need(byte length, byte height);
- Function: Return the memory requirement for a "txt_strattr_save"ed image.
-
- Arguments: = the memory requirement for a region of x-length "length" and
- y-height "height" is calculated
-
- Return Value: = memory requirement in bytes
-
- See Also: txt_attrs_save txt_chrattrs_save txt_chrs_save txt_strattr_save
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- void txt_attrs_save(byte x, y,
- byte length, byte height, textimagedata *attrs);
- Function: Read a region of attributes.
-
- Arguments: = stores the region of attributes from the corner "x","y" with
- x-length "length" and y-height "height" into "attrs"
- - if "x" = MEM, "attrs.x" is used
- - if "y" = MEM, "attrs.y" is used
- - if "length" = MEM, "attrs.length" is used
- - if "height" = MEM, "attrs.height" is used
-
- Notes: Make sure enough memory has been allocated to "attrs" by a call to
- "txt_attrs_need". If a "length" and/or "height" is given, it is
- stored in "attrs.length" and/or "attrs.height", respectively. See
- Global Type Definitions for a description of the structure
- "textimagedata".
-
- See Also: txt_attrs_need txt_attr_save txt_attrs_show txt_str_save
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- void txt_attrs_show(byte x, byte y,
- byte fgclr, byte bgclr, textimagedata *attrs);
- Function: Print a region of attributes.
-
- Arguments: = prints the region of attributes, stored in "attrs", with top-left
- corner "x","y"
- - if "x" = MEM, "attrs.x" is used
- - if "y" = MEM, "attrs.y" is used
- = if "fgclr" = NO, the foreground is not modified
- = YES, modifies the foreground with the stored colors
- = MEM, "attrs.fgclr" is used
- = if "bgclr" = NO, the background is not modified
- = YES, modifies the background with the stored colors
- = MEM, "attrs.bgclr" is used
- Notes: See Global Type Definitions for a description of the structure
- "textimagedata".
-
- See Also: txt_print txt_attr_show txt_str_show txt_attrs_save
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- byte txt_bg_get(byte x, byte y);
- Function: Return the background color at specified coordinates.
-
- Arguments: = background color is read from "x","y"
-
- Return Value: = background color at "x","y"
-
- See Also: txt_attr_save txt_fg_get
-
- --------------------------------------------------------------------------------
- ATTRIBUTE
- byte txt_fg_get(byte x, byte y);
- Function: Return the foreground color at specified coordinates.
-
- Arguments: = foreground color is read from "x","y"
-
- Return Value: = foreground color at "x","y"
-
- See Also: txt_attr_save txt_bg_get
-
- ================================================================================
- --------------------------------- CHARACTER ----------------------------------
-
- void txt_chr_attr_save(byte x, byte y, byte *fgclr, byte *bgclr, char *ch);
- Function: Save one character and its attribute.
-
- Arguments: = character "ch" at "x","y", with its background color "bgclr" and
- foreground color "fgclr", are saved
- - if "fgclr" = NULL, the foreground color is not stored
- - if "bgclr" = NULL, the background color is not stored
- - if "ch" = NULL, the character is not stored
-
- Notes: If "x" and "y" both equal TCUR, "txt_chr_attr_show" advances the text
- cursor position to one past the last character printed.
-
- See Also: txt_attr_save txt_chr_attr_show txt_chrattr_save
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chr_attr_show(byte x, byte y,
- byte fgclr, byte bgclr, char ch, int count);
- Function: Print a specific number of one character in a defined color.
-
- Arguments: = "count" characters "ch" are printed in foreground color "fgclr"
- and background color "bgclr" at "x","y"
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
-
- Notes: If "x" and "y" both equal TCUR, "txt_chr_attr_show" advances the text
- cursor position to one past the last character printed.
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_attr_save txt_chrattr_show txt_fillcol _txt_fillrow
- txt_str_attr_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chr_erase(byte x, byte y, int count);
- Function: Overwrite a specific number of characters with spaces.
-
- Arguments: = overwrites "count" characters at "x","y" with spaces (ASCII 32)
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_show txt_chrattr_show txt_chrattrs_show txt_chrs_erase
- txt_erase
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chr_get(byte x, byte y);
- Function: Read one character.
-
- Arguments: = returns the character at "x","y"
-
- Return Value: = ASCII value of character
-
- See Also: txt_chr_show txt_chrattr_save txt_chrs_save
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chr_show(byte x, byte y, char ch, int count);
- Function: Print a specific number of one character.
-
- Arguments: = prints "count" characters "ch" at "x","y"
-
- Notes: If "x" and "y" both equal TCUR, "txt_chr_show" advances the text
- cursor position to one past the last character printed.
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_attr_show txt_chr_erase txt_chr_get txt_chrattr_show
- txt_chrs_show txt_str_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chrattr_save(byte x, byte y, word *chrattr);
- Function: Store a character with its attribute.
-
- Arguments: = the character and its attribute are read from "x","y" and are
- stored in "chrattr"
-
- Return Value: = ASCII value of character that was saved
-
- See Also: txt_attr_save txt_chr_attr_save txt_chr_get txt_chrattr_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chrattr_show(byte x, byte y,
- byte fgclr, byte bgclr, word chrattr, int count);
- Function: Print a specific number of one character with its attribute.
-
- Arguments: = "count" characters and attributes, stored in "chrattr", are
- printed at "x","y"
- = if "fgclr" = NO, the foreground is not modified
- = if "bgclr" = NO, the background is not modified
-
- Notes: If "x" and "y" both equal TCUR, "txt_chr_show" advances the text
- cursor position to one past the last character printed. Use
- "txt_chr_erase" to erase "txt_chrattr_show"ed characters.
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_chr_attr_show txt_chr_erase txt_chrattr_save
- txt_chr_show
-
-
- --------------------------------------------------------------------------------
- CHARACTER
- char txt_chrattrs_fill(byte x, byte y, byte length, byte height,
- byte fgclr, byte bgclr, char ch);
- Function: Fill a screen region with a foreground and/or background color and a
- character.
-
- Arguments: = the region with a corner at "x","y", an x-length "length", and a
- y-height "height" is filled in foreground "fgclr", background
- "bgclr", and character "ch"
- - if "fgclr" = NO, the foreground is not modified
- - if "bgclr" = NO, the background is not modified
- - if "ch" = NO, no character is written
-
- Return Value: = ASCII value of first character overwritten
-
- See Also: txt_fill_area
-
- --------------------------------------------------------------------------------
- CHARACTER
- word txt_chrattrs_need(byte length, byte height);
-
- [see txt_attrs_need]
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrattrs_save(byte x, byte y,
- byte length, byte height, textimagedata *chrattrs);
- Function: Read a region with its attributes from the text screen.
-
- Arguments: = stores the region of characters and their attributes from the
- corner "x","y" with x-length "length" and y-height "height" into
- "chrattrs"
- - if "x" = MEM, "chrattrs.y" is used
- - if "y" = MEM, "chrattrs.x" is used
- - if "length" = MEM, "chrattrs.length" is used
- - if "height" = MEM, "chrattrs.height" is used
-
- Notes: Make sure enough memory has been allocated to "chrattrs" by a call to
- "txt_chrattrs_need". If a "length" and/or "height" is given, it is
- stored in "chrattrs.length" and/or "chrattrs.height", respectively.
- See Global Type Definitions for a description of the structure
- "textimagedata".
-
- See Also: txt_chrattrs_need txt_chrattrs_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrattrs_show(byte x, byte y,
- byte fgclr, byte bgclr, textimagedata *chrattrs);
- Function: Print a region with its attributes to the text screen.
-
- void txt_chrattrs_show_char(byte x, byte y, byte x_timage, byte y_timage,
- byte fgclr, byte bgclr, textimagedata *chrattrs);
- Function: Print only one character from a region with its attributes to the text
- screen.
-
- void txt_chrattrs_show_str(byte x, byte y, byte x_timage, byte y_timage,
- byte length, byte fgclr, byte bgclr, textimagedata *chrattrs);
- Function: Print only a string of character from a region with its attributes to
- the text screen.
-
- void txt_chrattrs_show_region(byte x, byte y, byte x_timage, byte y_timage,
- byte length, byte height, byte fgclr, byte bgclr, textimagedata *chrattrs);
- Function: Print only a region from a region with its attributes to the text
- screen.
-
- Arguments: = prints from a region of characters and their attributes, stored in
- "chrattrs", with top-left corner at "x","y"
- - if "x" = MEM, "chrattrs.y" is used
- - if "y" = MEM, "chrattrs.x" is used
- = if "fgclr" = NO, the foreground is not modified
- = YES, modifies the foreground with the stored colors
- = MEM, "chrattrs.fgclr" is used
- = if "bgclr" = NO, the background is not modified
- = YES, modifies the background with the stored colors
- = MEM, "chrattrs.bgclr" is used
- = txt_chrattrs_show_char - start from "x_timage","y_timage", inside
- the saved region
- = txt_chrattrs_show_str - start from "x_timage","y_timage", inside
- the saved region
- - go for length "length"
- = txt_chrattrs_show_region - start from "x_timage","y_timage", inside
- the saved region
- - go for length "length" and height
- "height"
-
- Notes: Use "txt_chrs_erase" to erase a "txt_chrattrs_show"ed region. See
- Global Type Definitions for a description of the structure
- "textimagedata".
-
- Return Value: Use "txt_chrs_erase" to erase a "txt_chrs_show"ed character.
-
- See Also: txt_chr_show txt_chrs_erase txt_chrattrs_save
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrs_erase(byte x, byte y, textimagedata *chrs);
- Function: Overwrite a "textimagedata"ed image with spaces.
-
- Arguments: = overwrites "chrs" with corner at "x","y" with spaces (ASCII 32)
- - if "x" = MEM, "chrs.y" is used
- - if "y" = MEM, "chrs.x" is used
-
- Notes: See Global Type Definitions for a description of the structure
- "textimagedata".
-
- See Also: txt_chr_erase txt_chrattrs_show txt_chrs_show txt_erase
- txt_str_erase txt_strattr_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrs_fill(byte x, byte y, byte length, byte height, char ch);
- Function: Fill a screen region with a character.
-
- Arguments: = the region with a corner at "x","y", an x-length "length", and a
- y-height "height" is filled in with character "ch"
-
- See Also: txt_fill_area
-
- --------------------------------------------------------------------------------
- CHARACTER
- word txt_chrs_need(byte length, byte height);
-
- [see txt_attrs_need]
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrs_save(byte x, byte y,
- byte length, byte height, textimagedata *chrs);
- Function: Read a region of characters from the text screen.
-
- Arguments: = stores the region of characters from the corner "x","y" with
- x-length "length" and y-height "height" into "chrs"
- - if "x" = MEM, "chrs.y" is used
- - if "y" = MEM, "chrs.x" is used
- - if "length" = MEM, "chrs.length" is used
- - if "height" = MEM, "chrs.height" is used
-
- Notes: Make sure enough memory has been allocated to "chrs" by a call to
- "txt_chrs_need". See Global Type Definitions for a description of the
- structure "textimagedata".
-
- See Also: txt_chr_get txt_chrs_need txt_chrs_show
-
- --------------------------------------------------------------------------------
- CHARACTER
- void txt_chrs_show(byte x, byte y, textimagedata *chrs);
- Function: Print a region of characters to the text screen.
-
- Arguments: = shows the region of characters, stored in "chrs", with top-left
- corner at "x","y"
- - if "x" = MEM, "chrs.y" is used
- - if "y" = MEM, "chrs.x" is used
-
- Notes: See Global Type Definitions for a description of the structure
- "textimagedata".
-
- See Also: txt_chr_show txt_chrs_erase txt_chrs_save
-
- ================================================================================
- ---------------------------------- CURSOR ------------------------------------
-
- void cur_get(cursordata *curdata);
- Function: Store all cursor information on the active page.
-
- void cur_get_abs(cursordata *curdata);
- Function: Store all cursor information on the active page as reported by the
- VGA card.
-
- Arguments: = cur_get - stores cursor information into "curdata"
- cur_get_abs
-
- Notes: "cur_get_abs" can be used before the call to "bestlib_init" because it
- does not rely on the internal variables set by "bestlib_init" (it reads
- the VGA registers directly).
-
- See Also: cur_get_coord cur_get_shape cur_set ms_get
-
- --------------------------------------------------------------------------------
- CURSOR
- void cur_get_coord(byte *x, byte *y);
- Function: Store the cursor location on the active page.
-
- void cur_get_coord_abs(byte *x, byte *y);
- Function: Store the cursor location on the active page as reported by the VGA
- card.
-
- byte cur_get_x(void);
- Function: Return the cursor abscissa on the active page.
-
- byte cur_get_x_abs(void);
- Function: Return the cursor abscissa on the active page as reported by the VGA
- card.
-
- byte cur_get_y(void);
- Function: Return the cursor ordinate on the active page.
-
- byte cur_get_y_abs(void);
- Function: Return the cursor ordinate on the active page as reported by the VGA
- card.
-
- Arguments: = cur_get_coord - stores cursor abscissa into "x" and ordinate
- cur_get_coord_abs into "y"
- - if "y" is NULL, "x" is assumed to be
- "byte *xy", a data structure that has "x" and
- "y" as consecutive bytes
-
- Notes: The "_abs" forms of the get cursor functions can be used before the
- call to "bestlib_init" because they do not rely on the internal
- variables set by "bestlib_init" (they read the VGA registers directly).
-
- Return Value: = cur_get_x - abscissa of cursor on active page
- = cur_get_x_abs - abscissa of cursor as reported by VGA card
- = cur_get_y - ordinate of cursor on active page
- = cur_get_y_abs - ordinate of cursor as reported by VGA card
-
- See Also: cur_get cur_get_shape ms_get
-
- --------------------------------------------------------------------------------
- CURSOR
- void cur_get_shape(byte *start, byte *end);
- Function: Store the text cursor's shape on the active page.
-
- void cur_get_shape_abs(byte *start, byte *end);
- Function: Store the text cursor's shape as reported by the VGA card.
-
- Arguments: = cur_get_shape - the starting scan line of the cursor is
- cur_get_shape_abs stored in "start" and the ending scan line
- is stored in "end"
- - if "end" = NULL, "start" is assumed to be
- "byte *start_end", a data structure that has
- "start" and "end" as consecutive bytes
-
- See Also: cur_get cur_set_shape
-
- --------------------------------------------------------------------------------
- CURSOR
- boolean cur_is_on(void);
- Function: Check if the cursor is on.
-
- Return Value: = TRUE if cursor is on
- = FALSE if it is not
-
- See Also: cur_off
-
- --------------------------------------------------------------------------------
- CURSOR
- void cur_off(void);
- Function: Turn the cursor off.
-
- void cur_on(void);
- Function: Turn the cursor on.
-
- See Also: cur_is_on
-
- --------------------------------------------------------------------------------
- CURSOR
- void cur_set(cursordata *curdata);
- Function: Set all the cursor's statistics on the active text page.
-
- void cur_set_bios(cursordata *curdata);
- Function: Set all the cursor's statistics via the BIOS on the active text page.
-
- Arguments: = cur_set - the cursor's statistics are read from the
- cur_set_bios structure "curdata"
-
- See Also: cur_set_coord cur_set_shape cur_get ms_set
-
- --------------------------------------------------------------------------------
- CURSOR
- byte cur_set_coord(byte x, byte y);
- Function: Set the cursor abscissa and ordinate on the active text page.
-
- void cur_set_coord_bios(byte x, byte y);
- Function: Set the cursor abscissa and ordinate via the BIOS on the active text
- page.
-
- byte cur_set_x(byte x);
- Function: Set the cursor abscissa on the active text page.
-
- byte cur_set_x_bios(byte x);
- Function: Set the cursor abscissa on the active text page via BIOS.
-
- byte cur_set_y(byte y);
- Function: Set the cursor ordinate on the active text page.
-
- byte cur_set_y_bios(byte y);
- Function: Set the cursor ordinate on the active text page via BIOS.
-
- Arguments: = cur_set_coord - the cursor's new position is at "x","y"
- cur_set_coord_bios
- = cur_set_x - the cursor's new abscissa is at "x"
- cur_set_x_bios
- = cur_set_y - the cursor's new ordinate is at "y"
- cur_set_y_bios
-
- Return Value: = cur_set_x - the cursor ordinate
- cur_set_x_bios
- = cur_set_coord - the cursor abscissa
- cur_set_y
- set_sety_bios
-
- See Also: cur_get cur_set ms_set
-
- --------------------------------------------------------------------------------
- CURSOR
- void cur_set_shape(byte start, byte end);
- Function: Define a new cursor shape
-
- void cur_set_shape_bios(byte start, byte end);
- Function: Define a new cursor shape on the active text page via the BIOS.
-
- Arguments: = cur_set_shape - the starting scan line of the cursor is set
- cur_set_shape_bios to "start" and the ending scan line is set
- to "end"
- - if "start" = NO, the starting scan line of
- the cursor is not modified
- - if "end" = NO, the ending scan line of the
- cursor is not modified
-
- Notes: "start" and "end" must be between 0 - 31.
-
- See Also: cur_get_shape cur_set
-
- ================================================================================
- ------------------------------------ GET -------------------------------------
-
- int txt_get_let(byte x, byte y, char *str, byte max, byte fillchar,
- char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get alphabet input from the keyboard.
-
- int txt_get_num(byte x, byte y, int *input, byte max, byte fillchar,
- char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get numeric input from the keyboard.
-
- int txt_get_numu(byte x, byte y, word *input, byte max, byte fillchar,
- char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get unsigned numeric input from the keyboard.
-
- STILL UNDER DEVELOPMENT
- int txt_get_numl(byte x, byte y, long int *input, byte max, byte fillchar,
- char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get long numeric input from the keyboard.
-
- STILL UNDER DEVELOPMENT
- int txt_get_numlu(byte x, byte y, unsigned long int *input, byte max,
- byte fillchar, char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get unsigned long numeric input from the keyboard.
-
- int txt_get_str(byte x, byte y, char *str, byte max, byte fillchar,
- char *msg, byte fgclr, byte bgclr, char *def);
- Function: Get string input from the keyboard.
-
- Arguments: = prints the message "msg" at "x","y" followed by the default
- response "def" and waits for user input
- = fills the empty response space with character "fillchar"
- - if "fillchar" = NO, the response space is not filled with a
- character
- = colors the response space with foreground "fgclr" and background
- "bgclr"
- - if "fgclr" = NO, the foreground color is not modified
- - if "bgclr" = NO, the background color is not modified
- = txt_get_let - stores user input in "str"
- - allows only alphabet letters to be inputed
- - accepts a maximum of "max" characters
- - if "max" = MAX, accepts a maximum of
- "str_len(str)" characters
- = txt_get_str - stores user input in "str"
- - allows all ASCII characters to be inputed
- - accepts a maximum of "max" characters
- - if "max" = MAX, accepts a maximum of
- "str_len(str)" characters
- = txt_get_num - stores the numerical value of user input in
- "input"
- - accepts a maximum number of "max" digits
- - input is allowed between -32768..32767
- - allows a maximum of 6 characters or the number of
- digits "max"
- = txt_get_numu - stores the numerical value of user input in
- "input"
- - accepts a maximum number of "max" digits
- - input is allowed between 0..65535
- - allows a maximum of 5 characters or the number of
- digits "max"
- = txt_get_numl - stores the numerical value of user input in
- "input"
- - accepts a maximum number of "max" digits
- - input is between -2 147 483 648..2 147 483 647
- - allows a maximum of 11 characters or the number of
- digits "max"
- = txt_get_numlu - stores the numerical value of user input in
- "input"
- - accepts a maximum number of "max" digits
- - input is allowed between 0..4 294 967 295
- - allows a maximum of 10 characters or the number of
- digits max"
-
- Notes: These functions will not wrap around the screen; the cursor will not go
- beyond the right screen boundary. They return upon the user pressing
- <ENTER> or <ESC>. Both "txt_get_let" and "txt_get_str" append the NULL
- character to "str" as the final character if <ENTER> is pressed -- it
- is placed as the first characters if <ESC> is pressed or if <ENTER> is
- pressed with no input. The cursor is shown during input and is hidden
- upon return (the cursor position is also restored upon return).
-
- "txt_get_num" accepts only numbers and the '+' and '-' and allows a
- maximum of six characters (five digits plus one sign) or a maximum of
- the number of digits "max"; if no sign prefixes the number, it is assumed
- to be positive. This function stores a zero in "input" if <ESC> is
- pressed or if <ENTER> is pressed with no input. "txt_getnum" will beep
- and prompt for a new entry if the user inputs a number less than -32768
- or greater than 32767.
-
- "txt_get_numu" accepts only numbers allows a maximum of five characters
- or a maximum of the number of digits "max". This function stores a zero
- in "input" if <ESC> is pressed or if <ENTER> is pressed with no input.
- "txt_getnumu" will beep and prompt for a new entry if the user inputs a
- number greater than 65535.
-
- "txt_get_numl" accepts only numbers and the '+' and '-' and allows a
- maximum of eleven characters (ten digits plus one sign) or a maximum of
- the number of digits "max"; if no sign prefixes the number, it is assumed
- to be positive. This function stores a zero in "input" if <ESC> is
- pressed or if <ENTER> is pressed with no input. "txt_getnuml" will beep
- and prompt for a new entry if the user inputs a number less than
- -2 147 483 648 or greater than 2 147 483 647.
-
- "txt_get_numlu" accepts only numbers allows a maximum of eleven
- characters or a maximum of the number of digits "max". This function
- stores a zero in "input" if <ESC> is pressed or if <ENTER> is pressed
- with no input. "txt_getnumlu" will beep and prompt for a new entry if
- the user inputs a number greater than 4 294 967 295.
-
- Return Value: = txt_get_let - number of characters typed
- txt_get_str - -1 if <ESC> is pressed
- = txt_get_num
- txt_get_numl
- txt_get_numlu - number of digits typed
- txt_get_numu - -1 if <ESC> is pressed
-
- ================================================================================
- ---------------------------------- STRING ------------------------------------
-
- void txt_str_attr_show(byte x, byte y,
- byte fgclr, byte bgclr, char *str, byte command);
- Function: Print a string with attributes.
-
- Arguments: = prints the string "str" in foreground color "fgclr" and
- background color "bgclr" at "x","y"
- - "command" determines how the string is printed
- - ALIGN_NONE no command
- - ALIGN_HORZ horizontal center; shifts odd lengths left
- - ALIGN_VERT vertical center; shifts odd lengths up
- - ALIGN_CENTER horizontal and vertical center
- - ALIGN_RIGHT right justify; flush to the right margin
- = if "fgclr" = NO, the foreground is not modified
- = if "bgclr" = NO, the background is not modified
-
- Notes: The command "command" will revert to ALIGN_NONE if the length of string
- "str" is greater than 80 (the width of the text screen). Only if "x"
- and "y" both equal TCUR, "txt_str_attr_show" advances the text cursor
- position to one past the last character printed.
-
- See Also: txt_chr_attr_show txt_str_show txt_strattr_show
-
- --------------------------------------------------------------------------------
- STRING
- word txt_str_erase(byte x, byte y, char *str, byte command);
- Function: Overwrite a string with spaces.
-
- Arguments: = the string "str" at "x","y" is overwritten with spaces (ASCII 32)
- = "command" determines how the string is erased
- - ALIGN_NONE no command
- - ALIGN_HORZ horizontal center; shifts odd lengths left
- - ALIGN_VERT vertical center; shifts odd lengths up
- - ALIGN_CENTER horizontal and vertical center
- - ALIGN_RIGHT right justify; flush to the right margin
-
- Notes: The command "command" will revert to ALIGN_NONE if the length of the
- string "str" is greater than 80 (the width of the text screen).
-
- Return Value: = length of "str"
-
- See Also: txt_chrs_erase txt_erase txt_str_erase_pr txt_str_show
-
- --------------------------------------------------------------------------------
- STRING
- word txt_str_erase_pr(byte x, byte y, printdata *prdata);
- Function: Overwrite "prdata.string" with spaces.
-
- Arguments: = the string "prdata.string" at "x","y" is overwritten with spaces
- (ASCII 32)
- - if "x" = MEM, "prdata.x" is used
- - if "y" = MEM, "prdata.y" is used
- Return Value: = length of "prdata.string"
-
- See Also: txt_erase txt_print txt_str_erase
-
- --------------------------------------------------------------------------------
- STRING
- word txt_str_save(byte x, byte y, byte length, char *str, byte command);
- Function: Read a string from the text screen.
-
- Arguments: = reads "length" characters from "x","y" into "str"
- - if "length" = NULL, the length of "str" is used for the number of
- character to read
- - "command" determines how the string is read
- - ALIGN_NONE no command
- - ALIGN_HORZ horizontal center; shifts odd lengths left
- - ALIGN_VERT vertical center; shifts odd lengths up
- - ALIGN_CENTER horizontal and vertical center
- - ALIGN_RIGHT right justify; flush to the right margin
-
- Notes: The NULL character is appended as the last character to "str".
-
- Return Value: = length of "str"
-
- See Also: txt_str_show txt_attrs_save txt_chr_get txt_strattr_save
-
- --------------------------------------------------------------------------------
- STRING
- word txt_str_show(byte x, byte y, char *str, byte command);
- Function: Print a string.
-
- Arguments: = prints the string "str" at "x","y"
- - "command" determines how the string is printed
- - ALIGN_NONE no command
- - ALIGN_HORZ horizontal center; shifts odd lengths left
- - ALIGN_VERT vertical center; shifts odd lengths up
- - ALIGN_CENTER horizontal and vertical center
- - ALIGN_RIGHT right justify; flush to the right margin
-
- Notes: The command "command" will revert to ALIGN_NONE if the length of string
- "str" is greater than 80 (the width of the text screen). Only if "x"
- and "y" both equal TCUR, "txt_str_show" advances the text cursor
- position to one past the last character printed.
-
- Return Value: = length of "str"
-
- See Also: txt_print txt_attrs_show txt_chr_show txt_str_attr_show
- txt_strattr_show txt_str_save txt_str_erase
-
- --------------------------------------------------------------------------------
- STRING
- word txt_strattr_need(byte length, byte height);
-
- [see txt_attrs_need]
-
- --------------------------------------------------------------------------------
- STRING
- word txt_strattr_save(byte x, byte y, shortint length, textimagedata *strattr);
- Function: Read a string with its attributes from the text screen.
-
- Arguments: = reads length "length" characters and their attributes from
- "x","y" into "strattr"
- - if "length" = MEM, "strattr.length" is used
-
- Notes: Make sure you have allocated enough memory to "strattr" by a call to
- "txt_strattr_need"; remember that each character requires TWO bytes
- (one for the character and one for its attribute). The NULL character
- is appended as the last character to "strattr". See Global Type
- Definitions for a description of the structure "textimagedata".
-
- Return Value: = character count of "strattr" (which is length / 2)
-
- See Also: txt_attrs_save txt_str_save txt_strattr_need txt_strattr_show
-
- --------------------------------------------------------------------------------
- STRING
- word txt_strattr_show(byte x, byte y, byte fgclr, byte bgclr,
- textimagedata *strattr, byte command);
- Function: Print a "txt_strattr_save"ed string with its attributes.
-
- Arguments: = prints the string with attributes "strattr" at "x","y"
- - "command" determines how the string is printed
- - ALIGN_NONE no command
- - ALIGN_HORZ horizontal center; shifts odd lengths left
- - ALIGN_VERT vertical center; shifts odd lengths up
- - ALIGN_CENTER horizontal and vertical center
- - ALIGN_RIGHT right justify; flush to the right margin
- = if "fgclr" = NO, the foreground is not modified
- = YES, modifies the foreground with the stored colors
- = MEM, "attrs.fgclr" is used
- = if "bgclr" = NO, the background is not modified
- = YES, modifies the background with the stored colors
- = MEM, "attrs.bgclr" is used
-
- Notes: The command "command" will revert to ALIGN_NONE if the length of string
- "strattr" is greater than 80 (the width of the text screen). Only if
- "x" and "y" both equal TCUR, "txt_strattr_show" advances the text
- cursor position to one past the last character printed. See Global
- Type Definitions for a description of the structure "textimagedata".
-
- Return Value: = character count of "strattr" (which is length / 2)
-
- See Also: txt_attrs_show txt_str_attr_show txt_chrs_erase txt_print
- txt_str_show txt_str_show txt_strattr_save
-
- ================================================================================
- ---------------------------------- WINDOW ------------------------------------
-
- word win_define(
- Function: Define a new window.
-
- Arguments: =
-
- Notes: None.
-
- Return Value: None.
-
- See Also:
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- WINDOW
- word win_move(
- Function: Move a window to absolute coordinates.
-
- Arguments: =
-
- Notes: None.
-
- Return Value: None.
-
- See Also:
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- WINDOW
- word win_move_rel(
- Function: Move a window relative to its current position.
-
- Arguments: =
-
- Notes: None.
-
- Return Value: None.
-
- See Also:
-
- Example Program: None.
-
- --------------------------------------------------------------------------------
- WINDOW
- word win_scroll(
- Function: Scroll a window.
-
- Arguments: =
-
- Notes: None.
-
- Return Value: None.
-
- See Also:
-
- Example Program: None.
-
- ================================================================================
-
-
- ==================================-----------===================================
- ------------------------------------ VGA -------------------------------------
- -----------
- void fade_in(void);
- Function: Fade into a screen.
-
- Notes: This usually follows a "fade_out".
-
- See Also: fade_out
-
- --------------------------------------------------------------------------------
- VGA
- void txt_fade_out(void);
- Function: Fade a screen out to black.
-
- Notes: This is usually followed by a "fade_in".
-
- See Also: fade_in
-
- --------------------------------------------------------------------------------
- VGA
- boolean isit_color(void);
- Function: Check if the current display adapter is color capable.
-
- boolean isit_ega(void);
- Function: Check if the current display adapter is EGA capable.
-
- boolean isit_vga(void);
- Function: Check if the current display adapter is VGA capable.
-
- STILL UNDER DEVELOPMENT
- boolean isit_svga(void);
- Function: Check if the current display adapter is SuperVGA capable.
-
- Notes: It is good practice to check if the desired display adapter is present
- before using it.
-
- Return Value: = isit_color - TRUE if adapter is color capable
- - FALSE if adapter is not color capable
- = isit_ega - TRUE if adapter is EGA capable
- - FALSE if adapter is not EGA capable
- = isit_vga - TRUE if adapter is VGA capable
- - FALSE if adapter is not VGA capable
- = isit_svga - TRUE if adapter is SuperVGA capable
- - FALSE if adapter is not SuperVGA capable
-
- ================================================================================
-
-
- =================================-------------==================================
- ----------------------------------- VGA16 ------------------------------------
- -------------
- void _16_boxfill(word x, word y, int length, int height, byte color, byte how);
- Function: Draw a solid box.
-
- void _16_boxfill_xy(word x1, word y1, word x2, word y2, byte color, byte how);
-
- Arguments: = a box with one corner at "x","y", an x-length of "length",
- and a y-height of "height" is drawn in color "color"
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
- - COPY_IMAGE_SET draws the image and sets to the current scroll
- - AND_IMAGE_SET ANDs the image and sets to the current scroll
- - OR_IMAGE_SET ORs the image and sets to the current scroll
- - XOR_IMAGE_SET XORs the image and sets to the current scroll
-
- Notes: The x-length "length" and y-height "height" can be negative.
-
- See Also: _16_boxoutline
-
- Example Program: This program creates the background pattern using the
- EXAMP006.EXE procedure boxfill.
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_boxoutline(int x, int y, int length, int height, int color,int how);
- Function: Draw the outline of a box.
-
- Arguments: = the outline of a box with one corner at "x","y", an x-length of
- "length", and a y-height of "height" is drawn in color "color"
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
- - COPY_IMAGE_SET draws the image and sets to the current scroll
- - AND_IMAGE_SET ANDs the image and sets to the current scroll
- - OR_IMAGE_SET ORs the image and sets to the current scroll
- - XOR_IMAGE_SET XORs the image and sets to the current scroll
-
- Notes: The x-length "length" and y-height "height" can be negative.
-
- See Also: _16_boxfill
-
- Example Program: This program creates the screen border using the procedure
- EXAMP006.EXE boxoutline.
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_floodall(int color, int scroll);
- Function: Flood the screen all one color.
-
- Arguments: = the screen is filled with color "color"
- = "scroll" determines relative to what the flood will occur:
- TRUE - relative to screen
- FALSE - relative to A000:0000
- See Also: _16_floodallall
-
- Example Program: This program floods the entire screen a select background
- EXAMP006.EXE color using the procedure floodall.
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_floodallall(int color);
- Function: Flood a 640x816 region of video memory all one color.
-
- Arguments: = the video memory is filled with color "color"
-
- Notes: The last three lines of video memory are left untouched. The total
- video memory is actually 640x819.
-
- See Also: _16_floodall
-
- --------------------------------------------------------------------------------
- VGA16
- STILL UNDER DEVELOPMENT
- void _16_linebiglen(int x, int y, int length,
- int height, int color, int how, int dimensions);
- Function: Draw a line using specific blocks.
-
- void _16_linebigxy(int x1, int y1, int x2, int y2,
- int color, int how, int dimensions);
- Function: Draw a line using specific blocks.
-
- Arguments: = linebiglen - a line with one end at "x","y", x-length "length"
- and y-height "height" is drawn in color "color"
- = linebigxy - a line with one end at "x1","y1" and the other end
- at "x2","y2" is drawn in color "color"
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
- - COPY_IMAGE_SET draws the image and sets to the current scroll
- - AND_IMAGE_SET ANDs the image and sets to the current scroll
- - OR_IMAGE_SET ORs the image and sets to the current scroll
- - XOR_IMAGE_SET XORs the image and sets to the current scroll
- = a line is drawn using the specific block size "dimensions"
-
- Notes: These procedures are identical to "linelen"/"linexy", except they draw
- a line using a specific block size instead of pixels. The dimensions
- of each block must be less than 9 and greater than 0.
-
- See Also: _16_linelen _16_linexy
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_linelen(int x, int y, int length, int height, int color, int how);
- Function: Draw a line.
-
- void _16_linexy(int x1, int y1, int x2, int y2, int color, int how);
- Function: Draw a line.
-
- Arguments: = linelen - a line with one end at "x","y", x-length "length" and
- y-height "height" is drawn in color "color"
- = linexy - a line with one end at "x1","y1" and the other end at
- "x2","y2" is drawn in color "color"
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
- - COPY_IMAGE_SET draws the image and sets to the current scroll
- - AND_IMAGE_SET ANDs the image and sets to the current scroll
- - OR_IMAGE_SET ORs the image and sets to the current scroll
- - XOR_IMAGE_SET XORs the image and sets to the current scroll
- See Also: _16_linebiglen _16_linebigxy
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_pixel(int x, int y, int color, int scroll);
- Function: Change the color of a pixel.
-
- Arguments: = the pixel at coordinates "x","y" is changed to color "color"
- = "scroll" determines relative to what the pixel will be set:
- TRUE - relative to screen
- FALSE - relative to A000:0000
-
- See Also: _16_pixel_avg _16_pixel_color _16_pixel_is _16_thermal
-
- --------------------------------------------------------------------------------
- VGA16
- int _16_pixel_avg(int x, int y, int scroll);
- Function: Return the average color of the nine pixels surrounding a point.
-
- Arguments: = pixels surrounding the coordinate "x","y" and the pixel at "x","y"
- are averaged
- = "scroll" determines relative to what the pixel will be read:
- TRUE - relative to screen
- FALSE - relative to A000:0000
-
- Return Value: = average color of pixels surrounding "x","y"
-
- See Also: _16_pixel
-
- --------------------------------------------------------------------------------
- VGA16
- int _16_pixel_color(int x, int y, int scroll);
- Function: Read the color a pixel.
-
- Arguments: = the pixel at coordinates "x","y" is read
- = "scroll" determines relative to what the pixel will be read:
- TRUE - relative to screen
- FALSE - relative to A000:0000
- Return Value: = color of the pixel at "x","y"
-
- See Also: _16_pixel
-
- --------------------------------------------------------------------------------
- VGA16
- boolean _16_pixel_is(int x, int y, int color, int scroll);
- Function: Check if a pixel is a certain color.
-
- Arguments: = the pixel at coordinates "x","y" is compared to color "color"
- = "scroll" determines relative to what the pixel will be checked:
- TRUE - relative to screen
- FALSE - relative to A000:0000
-
- Notes: This function is a combination of the pixel_color function and a
- comparison statement.
-
- Return Value: = TRUE if pixel "x","y" is color "color"
- = FALSE if pixel "x","y" is not color "color"
-
- See Also: _16_pixel
-
- --------------------------------------------------------------------------------
- VGA16
- int _16_popupcolumn(int x, int y, int choice,
- int maxopts, char *ptr[], int mousepresent);
- Function: Pop up a column in graphics mode.
-
- Arguments: = the top-left corner of the column is located at "x", "y".
- = the option number "choice" is active
- - the first menu is 1, the next is 2, etc.
- - if you always want it to start at the top of the available
- menus, make "choice" always equal to 1
- = there are "maxopts" options available
- - there is no maximum for this value
- = "ptr" is an array of char pointers to all of the options
- = "mousepresent" == TRUE if a mouse is present (it must have been
- initialized with a call to "ms_init()") or FALSE is not present
- - if a mouse is present, the left mouse button selects an option
- just as <ENTER> selects that option using the keyboard and the
- right mouse button cancels, just as <ESC> does through the
- keyboard
- - the keyboard commands can also be used
-
- Notes: This function is a simpler version of the function "popupmenu" and has
- the advantage of an unlimited number of choices (as opposed to 16 for
- "popupmenu"). It is ideal for lists of options, such as a directory
- listing.
-
- Return Value: = -1 if unable to allocate sufficient memory to hold a copy of the
- part of the screen that would be overwritten.
- = FALSE if the user aborted his selection
- = if a selection was made, the number is returned (top being 1)
-
- See Also: _16_popupmenu
-
- --------------------------------------------------------------------------------
- VGA16
- int _16_popupmenu(int x, int y, int choice, int maxmenus,
- char *ptr[], int data[][3], char *text[], int mousepresent);
- Function: Pop up a menu in graphics mode.
-
- Arguments: = the top-left corner of the menu is located at "x", "y".
- = the menu number "choice" is active
- - the first menu is 1, the next is 2, etc.
- - in the example program, if "choice" equalled 4, the highlighted
- menu would be DOS.
- - if you always want it to start at the top of the available
- menus, make "choice" always equal to 1
- = there are "maxmenus" menus available
- - there is a maximum of 16 menu possible
- - in the example program, "maxmenus" would equal 4
- = "ptr" is an array of pointers to all of the menus
- = "data" holds necessary information about the "text" array of
- pointers.
- - its three arrays are, in respective order:
- [number of submenus accessed from the corresponding menu]
- [index into *text]
- [1 = submenu active, 0 = submenu inactive, determined through
- bit positions from right to left]
- = "text" holds all of the submenus and dictates which menus are
- available to the user (menus that are unavailable will appear
- RED and the user will not be able to select them
- = "mousepresent" == TRUE if a mouse is present (it must have been
- initialized with a call to "ms_init()") or FALSE is not present
- - if a mouse is present, the left mouse button selects an option
- just as <ENTER> selects that option using the keyboard and the
- right mouse button cancels, just as <ESC> does through the
- keyboard
- - the keyboard commands can also be used
-
- In Example (ie):
-
- char *ptr[] = { "FILE", "PRINT", "SORT", "DOS" }; /* menus */
- char *text[] = { /* submenu options */
- (char *)0x000B, /* see NOTE 1 */
- "NEW", "LOAD", SAVE", /* submenus of menu 1 */
- "BLOCK", "ENTIRE DOCUMENT", "EXTERNAL FILE", /* submenus of menu 2 */
- "EXIT TO", "SHELL TO" /* submenus of menu 4 */
- };
- int data[][3] = { { 3, 1, 0x0007 }, /* corresponds to first menu */
- { 3, 4, 0x0004 }, /* see NOTE 2 */
- { 0, 0, 0x0000 }, /* corresponds to third menu */
- { 2, 7, 0x0003 } /* corresponds to fourth menu */
- }; ^ ^
- | +----- the index into "text"
- +--------- the number of submenus
- NOTE 1 - the numerical equivalent of the hexadecimal digit B is 1011
- - from right to left, each binary digit represents a menu
- - the rightmost digit represents the menu FILE, designating it active
- - the second-to-the-right digit represents the menu PRINT, designating
- it active
- - the second-to-the-left digit represents the menu SORT, designating
- it inactive
- - the leftmost digit represents the menu DOS, designating it active
- - the rest of the hexadecimal digits are ignored as there are only
- four menus as will be specified by the "maxmenus" parameter when
- popupmenu will be called
-
- NOTE 2 - the numerical equivalent for the hexadecimal digit 4 is 0100
- - from right to left, each binary digit represents a submenu
- - the rightmost digit represents the submenu BLOCK, designating it
- inactive
- - the second-to-the-right digit represents the submenu ENTIRE DOCUMENT,
- designating it inactive
- - the second-to-the-left digit represents the submenu EXTERNAL FILE,
- designating it active
- - the last bit, and the rest of the hexadecimal digits, are ignored as
- there are only 3 submenus as specified by the first number of that
- array cell
-
- DECIMAL TO HEXADECIMAL TO BINARY CONVERSION TABLE:
- +---------------+------+------+------+------+------+------+------+------+
- | DECIMAL DIGIT | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
- +---------------+------+------+------+------+------+------+------+------+
- | HEX DIGIT | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
- +---------------+------+------+------+------+------+------+------+------+
- | BINARY DIGIT | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
- =========================================================================
- | DECIMAL DIGIT | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
- +---------------+------+------+------+------+------+------+------+------+
- | HEX DIGIT | 8 | 9 | A | B | C | D | E | F |
- +---------------+------+------+------+------+------+------+------+------+
- | BINARY DIGIT | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
- +---------------+------+------+------+------+------+------+------+------+
-
- Notes: This is a very useful procedure that prompts for the user's response
- using a unique menu system. The menu pops up onto the screen and, when
- the user makes his choice, restores the screen. If the user presses
- the <ESC> key or, if the mouse is active, presses the right mouse
- button the menu closes and no selection is registered.
-
- Return Value: = -1 if unable to allocate sufficient memory to hold a copy of the
- part of the screen that would be overwritten.
- = FALSE if the user aborted his selection
- = if a selection was made, the
- - first four bits represent the submenu that was selected
- where "NEW" and "EXTERNAL FILE" were submenus
- - if "NEW" was selected, the return would be 1
- - if "EXTERNAL FILE" was selected, the return would be 3
- - second four bits represent the menu that was selected where
- "FILE" and "SORT" were menus
- - if "FILE" was selected, the return would be 1
- - if "SORT" was selected, the return would be 3
-
- See Also: _16_popupcolumn
-
- Example Program: Creates a simple menu system of common program options. The
- user can scroll through the menu options with the keyboard
- EXAMP002.EXE or, if a mouse was detected, with the mouse. If the user
- selects File-Load, some options will be enabled (as in common
- applications) and if the user selects File-New, some options
- will be disabled (also as in common applications). Below is
- an ASCII example of the form of the menu system:
-
- +---------------------------------+
- |==FILE=== NEW LOAD SAVE |
- | PRINT +-----------------------+
- | SORT |
- | DOS |
- +---------+
-
- If the user pressed the down arrow:
-
- +---------+ *** REMEMBER the second and third menu are currently
- | FILE | unavailable; that is why they were skipped
- | PRINT |
- | SORT +-----------------------+
- |==DOS==== EXIT TO SHELL TO |
- +---------+-----------------------+
-
- If the user pressed the right arrow:
-
- +---------+
- | FILE +
- | PRINT |
- | SORT +-----------------------+
- | DOS |==EXIT=TO== SHELL TO |
- +---------+-----------------------+
-
- *** NOTE THIS IS NOT A WYSIWYG (What You See Is What You Get)
- THE GRAPHICS MODE REPRESENTATION IS MUCH BETTER
-
- --------------------------------------------------------------------------------
- VGA16
- int _16_scrollevel(void);
- Function: Read the number of rows currently scrolled.
-
- Arguments: = None
-
- Return Value: = number of rows currently scrolled
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_scrollrow(int rows);
- Function: Scroll the screen a specific number of rows.
-
- Arguments: = "rows" rows are scrolled
- - if positive, scrolls down
- - if negative, scrolls up
- - if zero, restores video pointer to A000:0000 (default)
-
- Notes: Use "scrollrow" for smooth full-screen vertical scrolling.
-
- --------------------------------------------------------------------------------
- VGA16
- void _16_thermal(int x, int y, int length, int height);
- Function: Generate a thermal equilibrium style spread.
-
- Arguments: = each pixel inside the region with one corner at "x","y", an
- x-length of "length", and y-height of "height" is changed to the
- average color of its surrounding pixels [see _16_pixel_avg]
- = "scroll" determines relative to what the spread will begin:
- TRUE - relative to screen
- FALSE - relative to A000:0000
-
- See Also: _16_pixel
-
- ================================================================================
- --------------------------------- ANIMATION ----------------------------------
-
- void _16_animat(void *x_y_maxx_maxy, int newx, int newy, int index,
- imagedata *graphor[], imagedata *graph[], imagedata *segment[]);
- Function: Animate any "_16_i_save"ed image.
-
- Arguments: = the coordinates and dimensions of the image to move reside in
- the structure or array "x_y_maxx_maxy"
- = "graphor" points to the all-white version of the image
- = "graph" points to the true-color version of the image
- = the image addressed by the array "graph" and "graphor" with the
- index "index" will be moved to "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: "_16_animat" replaces the following four commands
- _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bg_screen);
- _16_i_show(newx, newy, OR_IMAGE, icon1_graphor[pic]);
- _16_i_show(newx, newy, XOR_IMAGE, icon1_graphor[pic]);
- _16_i_show(newx, newy, OR_IMAGE, icon1_graph[pic]);
- into one more efficient procedure.
-
- This animating image flashes white (as in the example program). This
- was my first attempt at an animation procedure, so it works only on
- relatively small images. It can be used for unusual effects. See
- Global Type Definitions for a description of the structure "imagedata".
-
- See Also: _16_animat_rect _16_animat_bss _16_animat_bvs _16_animat_p
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- ANIMATION
- void _16_animate_rect(int *x_y_maxx_maxy, int newx, int newy,
- int index, imagedata *graph[], imagedata *segment[]);
- Function: Animate any solid rectangular "_16_i_save"ed image.
-
- Arguments: = the coordinates and dimensions of the image to move reside in
- the structure or array "x_y_maxx_maxy"
- = the image addressed by the array "graph" with the index "index"
- will be moved to "newx","newy"
- = the background is stored at segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: Use this procedure for animating solid rectangular "_16_i_save"ed images
- It was specifically designed for this form of animation, replacing
- _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bg_screen);
- _16_i_show(newx, newy, COPY_IMAGE, icon1_graph[pic]);
- into one more efficient procedure. See Global Type Definitions for a
- description of the structure "imagedata".
-
- See Also: _16_animat _16_animat_bss _16_animat_bvs _16_animat_p
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- ANIMATION
- void _16_animat_bss(int oldx, int oldy, int newx, int newy,
- imagedata *oldgraph, imagedata *graph, imagedata *segment[]);
- Function: Animate any "_16_c_save"ed image.
-
- Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
- = the image "oldgraph" is at "oldx","oldy"
- = the image "graph" will be located at "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: One row of the background is restored, then one row of the image is
- written. Because only one line of the background is restored at a
- time, there is much less flicker than restoring the entire background
- under an image and then writing the image. For higher speed animation,
- use "_16_animat_bvs". See Global Type Definitions for a description of
- the structure "imagedata".
-
- See Also: _16_animat _16_animat_rect _16_animat_bvs _16_animat_p
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- ANIMATION
- STILL UNDER DEVELOPMENT
-
- void _16_animat_bvs(int oldx, int oldy, int newx, int newy,
- int id, imagedata *oldgraph, imagedata *graph[]);
- Function: Animate any "_16_c_save"ed image at 32-bit speed.
-
- Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
- = each unique image requires a unique identification number "id"
- (it is a constant that should not change
- = the image "oldgraph" is at "oldx","oldy"
- = the image "graph" will be located at "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: Two global arrays required: "memoryidentity" and "memoryaddress"
- unsigned int memoryidentity[MAXGRAPHICS];
- void *memoryaddress[MAXGRAPHICS];
- DO NOT MODIFY THESE ARRAYS -- THEY ARE USED BY THE ASSEMBLER ROUTINES
- "memoryidentity" is a unique graphic number for each separate image
- "memoryaddress" is an array of video memory offsets for each image
- See the example program for a working version.
-
- This procedure reads the images to animate from the invisible portions
- of the video RAM and transfers the images to the visible portions of
- video RAM through the internal 32-bit data path of the EGA/VGA card.
- The disadvantage is that there is only 217088 bytes of video RAM
- available, as opposed to 655360 bytes of system RAM. For slower
- transfers, but more memory, use the procedures that transfer the
- images from system RAM to video RAM 16-bits at a time. See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_animat _16_animat_rect _16_animat_bss _16_animat_p
-
- Example Program: None yet.
-
- --------------------------------------------------------------------------------
- ANIMATION
- void _16_animat_p(void *x_y_maxx_maxy, int newx, int newy,
- int index, imagedata *graph[], imagedata *segment[]);
- Function: Animate any "_16_p_save"ed image.
-
- Arguments: = the coordinates and dimensions of the image to move reside in
- the structure or array "x_y_maxx_maxy"
- = the image addressed by the array "graph" with the index "index"
- will be moved to "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: This procedure replaces the following
- _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bgscreen);
- _16_p_show(newx, newy, icon1_graphor[pic]);
- into one more efficient procedure. See Global Type Definitions for a
- description of the structure "imagedata".
-
- See Also: _16_animat _16_animat_rect _16_animat_bss _16_animat_bvs
-
- Example Program: EXAMP001.EXE
-
- ================================================================================
- ----------------------------------- IMAGE ------------------------------------
-
- void _16_copy(imagedata *destination, imagedata *source);
- Function: Copy any "_16_c_save"ed, "_16_i_save"ed, or "_16_p_save"ed image.
-
- Arguments: = "source" is copied into "destination"
-
- Notes: Both "destination" and "source" must be either "_16_c_save"ed,
- "_16_i_save"ed, or "_16_p_save"ed images -- "_16_copy" does not convert
- between the three formats. Make certain "destination" has been been
- allocated sufficient memory to hold "source". See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- IMAGE
- STILL UNDER DEVELOPMENT
- void _16_move(int oldx, int oldy, int newx, int newy,
- int id, imagedata *oldgraph, imagedata *graph[]);
- Function: Move any "_16_c_save"ed image 32-bits at a time.
-
- Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
- = each unique image requires a unique identification number "id"
- (it is a constant that should not change
- = the image "oldgraph" is at "oldx","oldy"
- = the image "graph" will be located at "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: Two global arrays required: "memoryidentity" and "memoryaddress"
- unsigned int memoryidentity[MAXGRAPHICS];
- void *memoryaddress[MAXGRAPHICS];
- DO NOT MODIFY THESE ARRAYS -- THEY ARE USED BY THE ASSEMBLER ROUTINES
- "memoryidentity" is a unique graphic number for each separate image
- "memoryaddress" is an array of video memory offsets for each image
- See the example program for a working version.
-
- This procedure reads the images to animate from the invisible portions
- of the video RAM and transfers the images to the visible portions of
- video RAM through the internal 32-bit data path of the EGA/VGA card.
- The disadvantage is that there is only 217088 bytes of video RAM
- available, as opposed to 655360 bytes of system RAM. For slower
- transfers, but more memory, use the procedures that transfer the
- images from system RAM to video RAM 16-bits at a time. When this
- procedure is written, it will provide the fastest graphic moves. See
- Global Type Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_move _16_i_move _16_p_move
-
- Example Program: None yet.
-
- = === === === === === === === === === === === === === === === === === === === ==
- ------------------------------ COMPRESS IMAGE --------------------------------
-
- void _16_c_move(int oldx, int oldy, int newx, int newy,
- imagedata *oldgraph, imagedata *graph, imagedata *segment[]);
- Function: Move any "_16_c_save"ed image.
-
- Arguments: = the image at "oldx","oldy" is moved to "newx","newy"
- = the old image "oldgraph" is at "oldx","oldy"
- = the new image "graph" becomes located at "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: One row of the background is restored, then one row of the image is
- written. Because only one line of the background is restored at a
- time, there is much less flicker than restoring the entire background
- under an image and then writing the image. This procedure provides the
- slowest graphic moves. See Global Type Definitions for a description of
- the structure "imagedata".
-
- See Also: _16_i_move _16_p_move _16_move
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- unsigned int _16_c_need_scrn(int left, int top, int length, int height);
- Function: Calculate the memory requirement of a "_16_c_save"ed image that is
- onscreen.
-
- Arguments: = calculates for an image with top-left at "left","top" and an
- x-length "length" and y-height "height"
-
- Notes: Use "_16_c_need_scrn" to determine the number of bytes to allocate to
- store a specific onscreen image. See "_16_c_need_wrst" to store a
- theoretical image.
-
- Return Value: = memory requirement in bytes
-
- See Also: _16_c_need_wrst _16_c_save _16_i_need _16_p_need
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- unsigned int _16_c_need_wrst(int length, int height);
- Function: Calculate the worst-case memory requirement of any "_16_c_save"ed
- image (in other words, zero percent compression).
-
- Arguments: = calculates for an image of x-length "length" and y-height
- "height"
-
- Notes: Use "_16_c_need_wrst" to determine the number of bytes to allocate to
- store a theoretical image with "_16_c_save". See "_16_c_need_scrn" to
- store an onscreen image.
-
- Return Value: = memory requirement in bytes
-
- See Also: _16_c_need_scrn _16_c_save _16_i_need _16_p_need
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- int _16_c_percent(imagedata *image);
- Function: Calculate how much percent smaller (or larger) a "_16_c_save"ed
- image is, compared to a "_16_p_save"ed image.
-
- Arguments: = compressed image "image" is used in the calculation
-
- Notes: If the return value is less than 100, the compressed image is smaller
- than the equivalent uncompressed image -- if it is greater than 100,
- the image would be smaller if stored with "_16_p_save". For examppe,
- if the returned value was 40, the compressed image is 60% smaller than
- the equivalent "_16_p_save"ed image (this is the average). See Global
- Type Definitions for a description of the structure "imagedata".
-
- Return Value: = percentage smaller (or larger) the compressed image is
-
- See Also: _16_c_save _16_i_save _16_p_save
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- STILL UNDER DEVELOPMENT
- int _16_c_read_off(imagedata *image, int offset);
- Function: Read the color of a pixel by an offset.
-
- Arguments: = pixel number "offset" is read from the image "image"
-
- Notes: "_16_c_read_off" is used for offset-based reads of a pixel's color
- where the first pixel is at offset 0. Pixels are numbered from left to
- right, top to bottom. For coordinate-based reads, see "_16_c_read_xy".
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- Return Value: = color of the addressed pixel
-
- See Also: _16_c_read_xy _16_i_read_off _16_p_read_off
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- STILL UNDER DEVELOPMENT
- int _16_c_read_xy(imagedata *image, int x, int y);
- Function: Read the color of a pixel by a coordinate.
-
- Arguments: = pixel addressed by "x","y" is read from the image "image"
-
- Notes: "_16_c_read_xy" is used for coordinate-based reads of a pixel's color.
- For offset-based reads, see "_16_c_read_off". See Global Type
- Definitions for a description of the structure "imagedata".
-
- Return Value: = color of the addressed pixel
-
- See Also: _16_c_read_off _16_i_read_xy _16_p_ready_xy
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- void _16_c_save(int left, int top, int length, int height,
- int transparency_color, imagedata *image, unsigned int size, int how);
- Function: Store an image from the screen using compression.
-
- Arguments: = the image with top-left "left","top", x-length "length", y-height
- "height", transparency color "transparency_color", and byte size
- "size" is stored into the memory location "image"
- - if byte size "size" = FALSE, the size will be calculated by a
- call to "_16_c_need_scrn"
- = "how" determines if the image will be saved relative to the
- current scroll or not
- - TRUE image is saved relative to the scroll
- - FALSE image is saved relative to A000:0000
-
- Notes: All of the given parameters are written to the "imagedata" structure.
- The transparency color is the color that represents the "holes" in the
- graphic where the background will show through. "_16_c_save" is faster
- if the byte size "size" is given. The compression algorithm creates
- about 60% smaller data as opposed to no compression. However,
- "_16_c_save" (and "_16_c_show") are the slowest at handling images.
- Make certain enough memory has been allocated to store the image. See
- Global Type Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_need_scrn _16_c_need_wrst _16_c_show _16_i_save _16_p_save
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- void _16_c_show(int x, int y, imagedata *image, byte how);
- Function: Write any "_16_c_save"ed image to the screen.
-
- Arguments: = the top-left corner of the image "image" will be at "x","y"
- - if "x" = -1, "imagedata.x" is used for the abscissa
- - if "y" = -1, "imagedata.y" is used for the ordinate
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
-
- Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
- "imagedata.y", respectively. The bit "imagedata.how" determines if the
- image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- See Also: _16_c_save _16_i_show _16_p_show
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- STILL UNDER DEVELOPMENT
- void _16_i_to_c(imagedata *destination_c, imagedata *source_i);
- Function: Convert any "_16_i_save"ed image to a "_16_c_save"ed image.
-
- Arguments: = "_16_i_save"ed format "source_i" is converted to "_16_c_save"ed
- format "destination_c"
-
- Notes: This procedure is equivalent to performing a "_16_i_show" and a
- "_16_c_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_c_to_p _16_i_to_p _16_p_to_c _16_p_to_i
-
- --------------------------------------------------------------------------------
- COMPRESS IMAGE
- STILL UNDER DEVELOPMENT
- void _16_p_to_c(imagedata *destination_c, imagedata *source_p);
- Function: Convert any "_16_p_save"ed image to a "_16_c_save"ed image.
-
- Arguments: = "_16_p_save"ed format "source_p" is converted to "_16_c_save"ed
- format "destination_c"
-
- Notes: This procedure is equivalent to performing a "_16_p_show" and a
- "_16_c_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_i
-
- = === === === === === === === === === === === === === === === === === === === ==
- -------------------------------- PIXEL IMAGE ---------------------------------
-
- STILL UNDER DEVELOPMENT
- void _16_c_to_p(imagedata *destination_p, imagedata *source_c);
- Function: Convert any "_16_c_save"ed image to a "_16_p_save"ed image.
-
- Arguments: = "_16_c_save"ed format "source_c" is converted to "_16_p_save"ed
- format "destination_p"
-
- Notes: This procedure is equivalent to performing a "_16_c_show" and a
- "_16_p_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- STILL UNDER DEVELOPMENT
- void _16_i_to_p(imagedata *destination_p, imagedata *source_i);
- Function: Convert any "_16_i_save"ed image to a "_16_p_save"ed image.
-
- Arguments: = "_16_i_save"ed format "source_i" is converted to "_16_p_save"ed
- format "destination_p"
-
- Notes: This procedure is equivalent to performing a "_16_i_show" and a
- "_16_p_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_p_to_c _16_p_to_i
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- void _16_p_move(void *x_y_maxx_maxy, int newx, int newy,
- int index, imagedata *graph[], imagedata *segment[]);
- Function: Move any "_16_p_save"ed image.
-
- Arguments: = the coordinates and dimensions of the image to move reside in
- the structure or array "x_y_maxx_maxy"
- = the image addressed by the array "graph" with the index "index"
- will be moved to "newx","newy"
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: This procedure replaces the following
- _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bgscreen);
- _16_p_show(newx, newy, icon1_graphor[pic]);
- into one more efficient procedure.
- This procedure currently provides the third fastest graphic moves. See
- Global Type Definitions for a description of the structure "magedata".
-
- See Also: _16_c_move _16_i_move _16_move
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- unsigned int _16_p_need(int length, int height);
- Function: Calculate the memory requirement of any "_16_p_save"ed image.
-
- Arguments: = calculates for an image of x-length "length" and y-height
- "height"
-
- Notes: Use "_16_p_need" to determine the number of bytes to allocate to store
- an image with "_16_p_save".
-
- Return Value: = memory requirement in bytes
-
- See Also: _16_c_need_scrn _16_c_need_wrst _16_i_need _16_p_save
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- int _16_p_read_off(imagedata *image, int offset);
- Function: Read the color of a pixel by an offset.
-
- Arguments: = pixel number "offset" is read from the image "image"
-
- Notes: "_16_p_read_off" is used for offset-based reads of a pixel's color
- where the first pixel is at offset 0. Pixels are numbered from left to
- right, top to bottom. For coordinate-based reads, see "_16_p_read_xy".
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- Return Value: = color of the addressed pixel's color
-
- See Also: _16_c_read_off _16_i_read_off _16_p_ready_xy
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- int _16_p_read_xy(imagedata *image, int x, int y);
- Function: Read the color of a pixel by a coordinate.
-
- Arguments: = pixel addressed by "x","y" is read from the graphic object
- addressed by "image"
-
- Notes: "_16_p_read_xy" is used for coordinate-based reads of a pixel's color.
- For offset-based reads, see "_16_p_read_off". See Global Type
- Definitions for a description of the structure "imagedata".
-
- Return Value: = color of the addressed pixel's color
-
- See Also: _16_c_read_xy _16_i_read_xy _16_p_ready_off
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- void _16_p_save(int left, int top, int length, int height,
- int transparency_color, imagedata *image, unsigned int size, int how);
- Function: Store an image from the screen based on a pixel by pixel algorithm.
-
- Arguments: = the image with top-left "left","top", x-length "length", y-height
- "height", transparency color "transparency_color", and byte size
- "size" is stored into the memory location "image"
- - if byte size "size" = 0, the size will be calculated by a call
- to "_16_p_need"
- = "how" determines if the image will be saved relative to the
- current scroll or not
- - TRUE image is saved relative to the scroll
- - FALSE image is saved relative to A000:0000
-
- Notes: All of the given parameters are written to the "imagedata" structure.
- The transparency color is the color that represents the "holes" in the
- graphic where the background will show through. "_16_p_save" is faster
- if the byte size "size" is given. This procedure (and "_16_p_show")
- are the second fastest at handling images. Make certain enough memory
- has been allocated to store the image. See Global Type Definitions for
- a description of the structure "imagedata".
-
- See Also: _16_c_save _16_i_save _16_p_need _16_p_show
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PIXEL IMAGE
- void _16_p_show(int x, int y, imagedata *image, byte how);
- Function: Write any "_16_p_save"ed image to the screen.
-
- Arguments: = the top-left corner of the image "image" will be at "x","y"
- - if "x" = -1, "imagedata.x" is used for the abscissa
- - if "y" = -1, "imagedata.y" is used for the ordinate
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
-
- Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
- "imagedata.y", respectively. The bit "imagedata.how" determines if the
- image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- See Also: _16_c_show _16_i_show _16_p_save
-
- Example Program: EXAMP001.EXE
-
- = === === === === === === === === === === === === === === === === === === === ==
- -------------------------------- PLANE IMAGE ---------------------------------
-
- STILL UNDER DEVELOPMENT
- void _16_c_to_i(imagedata *destination_i, imagedata *source_c);
- Function: Convert any "_16_c_save"ed image to a "_16_i_save"ed image.
-
- Arguments: = "_16_c_save"ed format "source_c" is converted to "_16_i_save"ed
- format "destination_i"
-
- Notes: This procedure is equivalent to performing a "_16_c_show" and a
- "_16_i_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
- See Also: _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- void _16_i_move(int oldx, int oldy, int newx, int newy,
- imagedata *oldgraph[], imagedata *graph[], imagedata *segment[]);
- Function: Move any "_16_i_save"ed image.
-
- void _16_i_move_rect(int oldx, int oldy, int newx, int newy,
- imagedata *oldgraph[], imagedata *graph[], imagedata *segment[]);
- Function: Move any solid rectangular "_16_i_save"ed image.
-
- Arguments: = the image at "oldx","oldy" is moved to "newx","newy"
- = the old image "oldgraph" is at "oldx","oldy"
- - "oldgraph[0]" is the full-color graphic and "oldgraph[1]" is the
- full-black version of the graphic
- = the new image "graph" becomes located at "newx","newy"
- - "graph[0]" is the full-color graphic and "graph[1]" is the
- full-black version of the graphic
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: One row of the background is restored, then one row of the image is
- written. Because only one line of the background is restored at a
- time, there is much less flicker than restoring the entire background
- under an image and then writing the image. This procedure currently
- provides the second fastest graphic moves. See Global Type Definitions
- for a description of the structure "imagedata".
-
- See Also: _16_c_move _16_p_move _16_move
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- unsigned int _16_i_need(int length, int height);
- Function: Calculate the memory requirement of any "_16_i_save"ed image.
-
- Arguments: = calculates for an image of x-length "length" and y-height
- "height"
-
- Notes: Use "_16_i_need" to determine the number of bytes to allocate to store
- an image with "_16_i_save".
-
- Return Value: = memory requirement in bytes
-
- See Also: _16_c_need_scrn _16_c_need_wrst _16_i_save _16_p_need
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- int _16_i_read_off(imagedata *image, int offset);
- Function: Read the color of a pixel an offset.
-
- Arguments: = pixel number "offset" is read from the image "image"
-
- Notes: "_16_i_read_off" is used for offset-based reads of a pixel's color
- where the first pixel is at offset 0. Pixels are numbered from left to
- right, top to bottom. For coordinate-based reads, see "_16_i_read_xy".
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- Return Value: = color of the addressed pixel
-
- See Also: _16_c_read_off _16_i_read_xy _16_p_read_off
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- int _16_i_read_xy(imagedata *image, int x, int y);
- Function: Read the color of a pixel coordinate.
-
- Arguments: = pixel addressed by "x","y" is read from the image "image"
-
- Notes: This function is used for coordinate-based reads of a pixel's color.
- For offset-based reads, see "_16_i_read_off".
-
- Return Value: = color of the addressed pixel
-
- See Also: _16_c_read_xy _16_i_read_off _16_p_ready_xy
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- void _16_i_save(int left, int top, int length, int height,
- imagedata *image, unsigned int size, int how);
- Function: Store an image from the screen based on a plane by plane algorithm.
-
- Arguments: = the image with top-left "left","top", x-length "length", y-height
- "height", and byte size "size" is stored into the memory location
- "image"
- - if byte size "size" = 0, the size will be calculated by a call
- to "_16_i_need"
- = "how" determines if the image will be saved relative to the
- current scroll or not
- - TRUE image is saved relative to the scroll
- - FALSE image is saved relative to A000:0000
-
- Notes: All of the given parameters are written to the "imagedata" structure.
- The "imagedata" structure will filled with information about "image".
- "_16_i_save" is faster if the byte size "size" is given. This
- procedure (and "_16_i_show") are the fastest at handling images. Make
- certain enough memory has been allocated to store the image. See
- Global Type Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_save _16_i_need _16_i_show _16_p_save
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- void _16_i_show(int x, int y, imagedata *image, byte how);
- Function: Write any "_16_i_save"ed image to the screen.
-
- Arguments: = the top-left corner of the image "image" will be at "x","y"
- - if "x" = -1, "imagedata.x" is used for the abscissa
- - if "y" = -1, "imagedata.y" is used for the ordinate
- = "how" determines how the image is placed onto the screen
- - COPY_IMAGE superimposes the box outline onto the screen
- - OR_IMAGE performs a logical OR with the screen contents
- - AND_IMAGE performs a logical AND with the screen contents
- - XOR_IMAGE performs logical exclusive-OR with screen contents
-
- Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
- "imagedata.y", respectively. The bit "imagedata.how" determines if the
- image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- See Also: _16_c_show _16_i_save _16_p_show
-
- Example Program: EXAMP001.EXE
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- STILL UNDER DEVELOPMENT
- void _16_p_to_i(imagedata *destination_i, imagedata *source_p);
- Function: Convert any "_16_p_save"ed image to a "_16_i_save"ed image.
-
- Arguments: = "_16_p_save"ed format "source_p" is converted to "_16_i_save"ed
- format "destination_i"
-
- Notes: This procedure is equivalent to performing a "_16_p_show" and a
- "_16_i_save" (without modifying the video memory). See Global Type
- Definitions for a description of the structure "imagedata".
-
- See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c
-
- --------------------------------------------------------------------------------
- PLANE IMAGE
- void _16_restore_bg(int left, int top,
- int length, int height, imagedata *segment[]);
- Function: Restore a section of the background.
-
- Arguments: = the portion of the background with its top-left corner at
- "left","top" and x-length "length" and y-height "height" is
- restored
- = the background is stored in segment "segment"
- - the background must have an x-width of 640, but can have a
- variable y-height
-
- Notes: The bit "imagedata.how" determines if the image is shown relative to
- the screen (TRUE) or relative to A000:0000 (FALSE). These instructions
- store the 640x816 background in memory location "segment"
- _16_i_save(0, 0, 640, 204, bgscrn[0], FALSE, FALSE);
- _16_i_save(0, 204, 640, 204, bgscrn[1], FALSE, FALSE);
- _16_i_save(0, 408, 640, 204, bgscrn[2], FALSE, FALSE);
- _16_i_save(0, 612, 640, 204, bgscrn[3], FALSE, FALSE);
- See Global Type Definitions for a description of the structure
- "imagedata".
-
- Example Program: EXAMP001.EXE
-
- ================================================================================
-
-
- =================================--------------=================================
- ----------------------------------- VGA256 -----------------------------------
- --------------
- void _256_pixel(int x, int y, int color, int scroll);
- Function: Change the color of a pixel.
-
- Arguments: = the pixel at coordinates "x","y" is changed to color "color"
- = "scroll" determines relative to what the pixel will be set:
- TRUE - relative to screen
- FALSE - relative to A000:0000
- --------------------------------------------------------------------------------
- VGA256
- void _256_floodall(int color, int scroll);
- Function: Flood the screen all one color.
-
- Arguments: = the screen is filled with color "color"
- = "scroll" determines relative to what the flood will occur:
- TRUE - relative to screen
- FALSE - relative to A000:0000
- ================================================================================
-
-
- ======================== END OF LIBRARY DOCUMENTATION ==========================
-
- ------------------------------------------------------------------------------
- DISCLAIMER
- To the best of my ability (and that is damn good), I have made the enclosed
- programs error free and compatible with all IBM PC clones from the 8088 up to
- the Pentium. I cannot be held accountable for the behavior of the enclosed
- programs or files and assume no liability for damages either from the direct
- use or as a consequence of the use/misuse of this product. Hence, this
- program and all information contained within should be used at one's own risk.
-
- This disclaimer is included to absolve me from the legal issues brought about
- by today's litigious society.
-
- --------------------------------------------------------------------------------
-
- If you have ANY comments or questions regarding this library or any other
- programs authored by me, George Vanous, feel free to reach me via email at
- vanous@helix.net
- or call me at (604)589-2675 or write to me: George Vanous
- 8930 Watson Court
- Delta, BC
- V4C 4T6
-
- REALiTY
-